我对 Apache 不是很坚定,所以如果这个问题看起来有点明显,请原谅。
我想通过 .htaccess 文件将特定目录中导致错误 403 的请求重定向到我的网络服务器根目录。
所以https://thedomain.com/secretlair/ https://thedomain.com/secretlair/ -> 域 https://thedomain.com
到目前为止我用过:
RewriteEngine on
RewriteBase /
RewriteRule (.*) https://thedomain.com/$1 [R=301,L]
它可以工作,但也会产生重定向问题https://thedomain.com/secretlair/thefile.txt https://thedomain.com/secretlair/thefile.txt to https://thedomain.com/thefile.txt https://thedomain.com/thefile.txt
我需要改变什么才能使这项工作正常进行?
多谢!
你可以只使用一个ErrorDocument
处理程序403
错误而不是像这样的重写规则:
ErrorDocument 403 https://thedomain.com/
在测试此更改之前,请确保清除浏览器缓存。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)