Posted by Janwillem Borleffs on 12/22/05 00:20
andrew.bistak@gmail.com wrote:
> RewriteEngine On
> RewriteBase /
> RewriteRule ^([^/]+)\.html$ pdisplay.php?page=p2/$1&type=htm
> RewriteRule ^([^/]+)\.html$ gdisplay.php?page=g2/$1&type=htm
>
> does anyone know why this rewrite won't work? It works for the first
> rule but not the second
>
Probably because the conditions for both rules are identical, so Apache
selects the first available match.
Something like the following would work better, where the pattern is altered
by modifying the file extension:
RewriteRule ^([^/]+)\.html$ pdisplay.php?page=p2/$1&type=html
RewriteRule ^([^/]+)\.htm$ gdisplay.php?page=g2/$1&type=htm
Another solution would be to use only the first one and have pdisplay.php
handle the redirect to gdisplay.php (when required).
JW
[Back to original message]
|