httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John David Ratliff <>
Subject [users@httpd] mod_rewrite rule loses match on second rewrite rule
Date Tue, 27 Apr 2004 17:39:05 GMT
I have recently changed a directory on my website. I want to redirect 
requests from the old directory to the new directory.

I also changed from using perl cgi scripts to PHP scripts. I would like 
to write one set of rules that allows me to correct both these problems.

RewriteCond     %{QUERY_STRING}                 ^p=(.*)
RewriteRule     ^tigcc-asm(.*)                  assembly$1
RewriteRule     ^([^/]*/?)index\.cgi            /$1%1.php?              

So, if I should get a request for http://website/tigcc-asm/index.cgi?p=foo
then I want it to become

However, what actually happens is this:

http://website/tigcc-asm/index.cgi?p=foo becomes

It seems to forget what %1 is on the second rule. However, if I put %1 
in the first rule, foo will show up.

I read the apache mod_rewrite guide and the Practical Solutions for URL 
manipulation guide, but they didn't seem to have an answer to this problem.
I have tried several variations of the above. Adding a slash before 
assembly$1. I tried using the next [N] flag. None of these things helped.

I can place them separately, but I have more rules I want to add for 
other special cases.

Thanks for any assistance,

John David Ratliff

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message