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 解决。
主域包类似于 www.domain.com,我一直在将新域添加到我的计划中,并且这些域已作为 dns 重定向到该主域包中的子文件夹。我没有意识到任何人都可以通过输入 www.domain.com/otherdomain 访问这些新域
托管公司说那些应该被命令放在更高的级别,但我不知道。有没有办法限制如果有人意外发现或测试示例,“其他域”将不允许从 www.domain.com 重定向?或者什么是正确的方法?
您需要将规则作为otherdomain/.htaccess文件中的第一条规则:
otherdomain/.htaccess
RewriteEngine On # if hostname in request is domain.com RewriteCond %{HTTP_HOST} domian\.com$ # return forbidden error RewriteRule ^ - [F]