开发者

All except one directory in mod_rewrite

I have little problem with mod_rewrite and I absolutely have no idea what to do with this.

I have this rule:

RewriteRule ^([\w/]*)$ index.php/?page=$1 [L]

This rule works for every directory. I want this rule to work but except one directory - "test". What I need to change in this rule?

For example: I want this URLS redirecting to index.php/?page=$1: http://test.com/account http://test.com/dog http://test.com/cat And I 开发者_如何学Cwant only this URL not redirecting to index.php/?page=$1: http://test.com/test (only test)

Thanx!


Add this RewriteCond line just before your rewrite rule, so it looks like this:

RewriteCond %{REQUEST_URI} !^/test(/|$)
RewriteRule ^([\w/]*)$ index.php/?page=$1 [L]

If (for some strange reason) it does not work -- please provide an example of working URL (the one that needs to be redirected) and the one that should not.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜