开发者

.htaccess mod_rewrite - limit to root directory

开发者 https://www.devze.com 2023-02-02 04:50 出处:网络
开发者_高级运维How to apply a rule only to the root directory (where it\'s placed)?How about putting:
开发者_高级运维

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

精彩评论

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