请为.htaccess应该返回404,而不是403

编程入门 行业动态 更新时间:2024-10-23 20:31:34
本文介绍了请为.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

本文发布于:2023-10-31 15:42:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546536.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:而不是   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!