开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜