Redirect all requests but one
I wonder how to redirect all requests like
foobar.com/cat
foobar.com/cat/1
foobar.com/etc
to
开发者_运维问答foobar.com/index.php
But not to affect
foobar.com/webmaster/
I don`t want foobar.com/webmaster/ to redirect to index.php. I want it default behavior
How to do that with mod_rewrite?
RewriteEngine on
RewriteRule ^webmaster/ - [QSA,L]
RewriteRule .* index.php [QSA,L]
try this foobar.com/(?!webmaster)[\w\/\d\_\-\:\;\?\=\.]+
as your regular expression to match all other except foobar.com/webmaster/
Apply this regex to select all except foobar.com/webmaster/ and match with
foobar.com/cat
foobar.com/cat/1
foobar.com/etc
add replace with
foobar.com/index.php
精彩评论