开发者

htaccess - Redirect when not

I have the following rule to redirect all traffic to a subfolder. However, now I need to stop it doing so in certain situations.

#
RewriteEngine On

RewriteCond %{HTTP_HOST} mywebsite.com
RewriteCond %{REQUEST_URI} !cms/
RewriteRule ^(.*)$ cms/$1 [L]
#

If the incoming request is http://www.mywebsite.com/goodies/ I wo开发者_如何学编程uld like to ignore the above redirect.

Can anyone help me?


Replace your second condition line

RewriteCond %{REQUEST_URI} !cms/

by

RewriteCond %{REQUEST_URI} !^/(cms|goodies)/


Add condition before RewriteRule as you do for cms/

RewriteCond %{REQUEST_URI} !goodies/
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜