本文介绍了请为.htaccess应该返回404,而不是403的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是形式的后续的有没有办法强制Apache将返回403 404,而不是的这说明 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:
example/.htaccess
我收到了403,而不是404,如果我有(或没有),这在我的的.htaccess 文件:
RedirectMatch 404 ^/\.htaccess$
有没有一种方法来覆盖默认403 - 来自内部的的.htaccess 文件本身
推荐答案就在我贴我的问题,我来到了朝以下解决办法:
Just after I posted my question, I came to a solution towards the following:
- 模仿默认的服务器配置的<文件> 为 .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
发布评论