httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew Wherry" <matt.whe...@googlemail.com>
Subject [users@httpd] exact matching in mod_rewrite
Date Thu, 29 May 2008 08:50:24 GMT
Hi

I am looking for some advice on how to do exact matching for mod_rewrite, I
have the 2 rules in my config:

Rule1
====
RewriteRule ^/nokian95 /phones.php?id=555 [PT,QSA,NS,NE]
RewriteCond %{REQUEST_URI} ^(.*)phones\.php(.*)$
RewriteCond %{QUERY_STRING} ^id\=555$
RewriteRule ^(.*)$ /nokian95? [R=301,L]


and

Rule2
====
RewriteRule ^/nokian95plum /phones.php?id=588 [PT,QSA,NS,NE]
RewriteCond %{REQUEST_URI} ^(.*)phones\.php(.*)$
RewriteCond %{QUERY_STRING} ^id\=588$
RewriteRule ^(.*)$ /nokian95plum? [R=301,L]



Now as the Rule1 is first in the config file then any URL string that
contains /nokian95 will result in /phones.php?id=555 being called, Rule2
will never be matched because Rule1 will match first.

I want to be able to specify that a match is only valid when the text to be
matched is *exactly* the text in the rewriterule and not just a fragmement
match.

Can anyone help me with a pointer?

Thanks
M

Mime
View raw message