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. Use '$' for matching the ending of a line as follows: Rule1: RewriteRule ^/nokian95$ /phones.php?id=555 [PT,QSA,NS,NE] Rule2: RewriteRule ^/nokian95plum$ /phones.php?id=588 [PT,QSA,NS,NE] Similar to '^' - which matches the beginning of the line - '$' matches any String which ends with the specified characters. --- Severin --------------------------------------------------------------------- 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@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx