----- Original Message -----
From: "Dave Kaufman" <[EMAIL PROTECTED]>
To: "Les Mikesell" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, January 05, 2001 11:09 PM
Subject: Re: [OT] Rewrite arguments?


> > One of us is missing something.  I hope it is me, but when I turn on
> > rewrite logging, the input side contains only the location portion.  The
> > argument string has already been stripped.
>
> the query string is stripped from what the rewrite rule is matching, yes.
but
> you can use a RewriteCond above the rule to test %{QUERY_STRING} against a
> regexp pattern, and store backreferences from it as %1, %2...etc.

That's it - thank you very much.  I had seen how to match and reuse chunks
in the RewriteCond, but somehow missed the ability to substitute them
in the RewriteRule.  I should have known it was too useful to have
been left out.

> # match and store the interesting arg values as backrefs
> RewriteCond %{QUERY_STRING} arg1=([0-9]+)&arg2=([0-9]+)
> # build a new QS for the proxy url
> RewriteRule ^/cgi-bin/prog
> http://otherhost/prog?newarg1=%1&arg2=%2&uname=me&pwd=password [R,L]

Since I only want to substitute one argument name without knowing much
else I think this will work:
RewriteCond      %{QUERY_STRING} (.*)(arg1=)(.*)
RewriteRule ^/cgi-bin/prog
http://otherhost/prog?%1newarg1=%2&uname=me&pwd=password [P,L]
(I want a proxy request to hide the password usage, not a client redirect
but either could work)

    Les Mikesell
       [EMAIL PROTECTED]


Reply via email to