Forum Moderators: phranque
I want to rewrite
/any-path/other-path/any-string-(\d+).html using detail.php
except those that end with page-(\d+).html
this is what I have:
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteCond %{REQUEST_FILENAME}!-l
RewriteCond %{REQUEST_URI}!^(.*)page-(\d+)\.htm[l]?(.*)$
RewriteRule (.*)-(.*)\.htm[l]?$ detail.php [QSA,NC]
However all pages get redirected to detail.php
any thoughts?
"File exists" checks are very inefficient, and should be avoided when possible. I have re-arranged the code slightly to avoid unnecessary checks. Other tweaks are for parsing efficiency only.
RewriteCond %{REQUEST_URI}!page-[0-9]+\.html?
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteCond %{REQUEST_FILENAME}!-l
RewriteRule ^[^-]+-[^.]+\.htm[l]?$ detail.php [NC,QSA,L]
[edited by: jdMorgan at 7:21 pm (utc) on June 29, 2007]