关于rewriteRule的一个小问题

RewriteEngine on
# RewriteRule ^test.php$ modrewrite.php
# RewriteRule ^(.*) http://www.baidu.com [L]

# RewriteRule ^(.*) public/$0 [L]
#因为.* 也匹配了public/ 所以会无限递归循环. 导致请求失败(不可行)

# RewriteRule ^[^/]*$ public/$0 [L]
#第一个 ^ 表示 开始 [] 中的 ^表示不匹配^后面的任意一个字符 $ 表示 结束 这种写法只能匹配不含有/的请求路径(可行)

# RewriteRule !^public/ public%{REQUEST_URI} [L]
# !表示逻辑非 ^匹配开始(推荐)

详见:http://stackoverflow.com/questions/1611506/request-exceeded-the-limit-of-10-internal-redirects-due-to-probable-configuratio

原文地址:https://www.cnblogs.com/xiaorenwu702/p/6125081.html