通过 404 而不是 403 拒绝 [英] Denying via 404 instead of 403
问题描述
我对 phpmyadmin 进行了以下设置:
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>
所以本质上,我只允许从本地主机访问 phpmyadmin.如果外界有人尝试访问 http://mydomain/phpmyadmin,他们会收到 403(禁止访问).这可能会让他们知道它就在那里,但他们就是无法得到它.
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.
问题: 在这种情况下,我宁愿让 Apache 返回 404.这可能吗?
Question: I'd rather have Apache return a 404 in this instance. Is that possible?
推荐答案
我在互联网上寻找类似问题的答案.虽然 mod_rewrite 是一个可能的解决方案,但我发现最好的解决方案是使用RedirectMatch"指令.
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.
参见 StackOverflow:将 403 Forbidden 重定向到 404 Not Found 的问题一个>
这篇关于通过 404 而不是 403 拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!