请为.htaccess应该返回404,而不是403 [英] Requests to .htaccess should return 404 instead of 403
本文介绍了请为.htaccess应该返回404,而不是403的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是形式的后续的有没有办法强制Apache将返回403 404,而不是<? / em>的这说明 RedirectMatch
来404来实现这一点。
This is sort of a follow-up to Is there a way to force apache to return 404 instead of 403? which suggested RedirectMatch
to 404 to accomplish this.
它完美地适用于大多数的事情,但是如果我要求:
It works perfectly fine for most of anything, however if I request:
http://example.com/.htaccess
我收到了403,而不是404,如果我有(或没有),这在我的的.htaccess
文件:
RedirectMatch 404 ^/\.htaccess$
有没有一种方法来覆盖默认403 - 来自内部的的.htaccess
文件本身
推荐答案
就在我贴我的问题,我来到了朝以下解决办法:
Just after I posted my question, I came to a solution towards the following:
- 模仿默认的服务器配置的
&LT;文件&GT;
为.HT
类型的文件规则 - 允许他们。
- 重定向到404。
- Mimic the default server configuration's
<Files>
rules for.ht
type of files. - Allow them.
- Redirect them to 404.
是这样的:
<Files ~ "^\.ht">
Order Deny,Allow
Allow from all
Satisfy All
Redirect 404 /
</Files>
这篇关于请为.htaccess应该返回404,而不是403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文