通过404,而不是403拒绝

通过404,而不是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.

问:我宁愿有阿帕奇在这种情况下返回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重定向严禁404未找​​到