different behaviour on a different server

Oh, the strange things mod_rewrite does!

different behaviour on a different server

Postby Stefano » Fri Apr 15, 2005 8:46 am

OK I wrote up some rewrite rules on one of our test servers and found that they worked fine. I then moved these rules to our live server and found that they caused endless loops. After much playing around I found that if I created a directory with the same name as the first matching element of my rules they would start working. What is odd though is that on the test server this was not required yet on the live server it was. They are both the same version of apache compilled almost identically.

Anyway here is an example of what I am talking about:

RewriteRule agency/(.*)-(.*)-([0-9]+)\.html http://www.test.com/newdir/$2.php?xc=$3 [L]

On the one server this works great, on the other server it does the loop. Any ideas?
Stefano
 

Postby Caterham » Sun Apr 17, 2005 2:16 pm

There is no conflict with the substitution and the pattern, but anyway, the "http://www.test.com" is not needed and .* should be avoided, anchors (^and $) should be placed


Code: Select all
RewriteRule ^agency/([^-]+)-([^-]+)-([0-9]+)\.html$ /newdir/$2.php?xc=$3 [L]
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm


Return to Idiosyncrasies

Who is online

Users browsing this forum: No registered users and 4 guests

cron