开发者

.htaccess mod_rewrite - limit to root directory

开发者_高级运维

How to apply a rule only to the root directory (where it's placed)?


How about putting:

RewriteCond %{REQUEST_URI} /([^/]*)

before any of your rules. That will match on any number of characters that are not a slash.


I would use the following

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/[^/]*(\?.*)?$
# your rewrite code here
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜