regex - htaccess - how to not redirect based on url pattern -
regex - htaccess - how to not redirect based on url pattern -
rewriteengine on rewritecond %{http_host} !^www\.example\.com rewriterule (.*) http://www.example.com/$1 [r=301,l] # load index.php default directoryindex index.php rewritebase / # other requests load room.php rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^((?!(index|room)\.php).+)$ room.php?u=$1 [l,nc]
my htaccess redirect room.php
if url contains else root directory such http://www.example.com/anythingelse
if not simple direct index.php
but need able not include redirect particular patters can create content in particular folders. instance
http://www.example.com/1 http://www.example.com/2 http://www.example.com/3 http://www.example.com/4
is possible?
you can add together these exclusions in regex pattern:
rewriteengine on rewritecond %{http_host} !^www\.example\.com rewriterule (.*) http://www.example.com/$1 [r=301,l] # load index.php default directoryindex index.php rewritebase / # other requests load room.php rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_uri} !^/(1|2|3|4) rewriterule ^((?!(index|room)\.php).+)$ room.php?u=$1 [l,nc]
regex apache .htaccess mod-rewrite
Comments
Post a Comment