Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试通过 .htaccess 将所有子目录重定向到我网站的根目录!如果我尝试访问子目录,下面的代码可以正常工作......但不允许我在根目录中显示索引页面,因为会启动重定向循环!
RedirectMatch temp ^/.*$ http://localhost/
我该如何解决这个问题?
如果您希望所有子目录都重定向到主页,您可以执行以下操作:
RedirectMatch temp ^/.+/.*$ http://localhost/
这将匹配其中包含两个斜杠的任何 URI,它们之间至少有一个字符。