httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <jos...@slive.ca>
Subject Re: [users@httpd] Rewrite-problem
Date Mon, 10 Feb 2003 00:16:08 GMT

On Mon, 10 Feb 2003, Sander Holthaus - Orange XL wrote:

> I tried you suggestion (and a few variations of it) but it puts the server
> in an infinite loop, because as I said, the ?-mark is in the path found by
> Apache, and thus the rewritten URL also has a querystring in it.

Ahhh... If you want to cut off the query string, you need to tag a ? on to
the end of the RewriteRule.  By default, mod_rewrite passes the query
string from the original request to the new request untouched.  It is NOT
matched in the (.*).  This is all in the docs (although, admittedly, so
are a million other things; the mod_rewrite docs are quite dense).

> RewriteEngine on
> # RewriteCond %{QUERY_STRING} !^$   # always true?!
> RewriteCond %{QUERY_STRING} (.*)
> RewriteRule ^(.*)     http://www.otherdomain.nl/$1
> [R,CO=campaign:$2:.domain.nl]

RewriteCond %{QUERY_STRING} (.*)
RewriteRule ^(.*)     http://www.otherdomain.nl/$1? [R,CO=campaign:%1:.domain.nl]

You need to use %1 to get the back-reference.  $2 will be empty.

And don't even think about filing a bug report on this until you have
tried the RewriteLog at RewriteLogLevel 9 to see exactly what mod_rewrite
is doing.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message