通过 404 而不是 403 拒绝
我对 phpmyadmin 有以下设置:
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
Order Deny,Allow
Allow from 127.0.0.1
Deny from all
...
</Directory>
所以本质上,我只允许从本地主机访问 phpmyadmin。如果外部世界的某人尝试访问 http://mydomain/phpmyadmin 他们将收到 403(禁止)。这可能会让他们知道它就在那里,但他们就是无法到达。
问题:在这种情况下,我宁愿让 Apache 返回 404。这可能吗?
I have the following setup for phpmyadmin:
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
Order Deny,Allow
Allow from 127.0.0.1
Deny from all
...
</Directory>
So essentially, I only allow phpmyadmin to be accessible from localhost. If someone from the outside world attempts to go to http://mydomain/phpmyadmin they'll get a 403 (Forbidden). This might tip them off to the fact it's there, but they just can't get to it.
Question: I'd rather have Apache return a 404 in this instance. Is that possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在互联网上查找类似问题的答案。虽然 mod_rewrite 是一个可能的解决方案,但我发现最好的解决方案使用“RedirectMatch”指令。
请参阅 StackOverflow:将 403 Forbidden 重定向到 404 Not Found 时出现问题
I've looked around the internet for an answer to a similar problem. While mod_rewrite is a possible solution, I find the best solution uses the "RedirectMatch" directive.
See StackOverflow: Problem redirecting 403 Forbidden to 404 Not Found