禁用“无法提供目录"错误

编程入门 行业动态 更新时间:2024-10-28 01:18:42
本文介绍了禁用“无法提供目录"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

在我的网站上,我有一个 /upload 目录.而且我希望人们看到目录中的内容列表(仍然可以查看其中的文件) - 所以对我来说以下错误消息不是错误.

On my website I have an /upload dir. And I don't want people to see a list of the content in the dir (the files in it can still be viewed) - so to me the following error message is not an error.

有没有办法禁用以下错误消息,同时保持 /upload 目录列表禁用/禁止?

Is there a way to disable the following error message, while keeping /upload Directory Listing disabled/forbidden?

[autoindex:error] [pid 17883] [client IP:16603] AH01276: Cannot serve directory /var/www/my-site/upload/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive

我不希望它出现在我的 error.log 中,因为我不认为它是一个错误.

I don't want it to be in my error.log since I don't consider it an error.

我想我可以在目录中创建我自己的禁止"index.html 文件,但是这个问题是针对多个文件夹的,所以我宁愿不这样做(如果可能的话).

I guess I could make my own "Forbidden" index.html file in the dir, but this problem is for multiple folders, so I rather not (if possible).

推荐答案

您可以将受影响的目录与例如匹配RewriteRule 并匹配尾部斜杠并返回 [F] 或 [G],这将是静默的.否则,无法直接在 mod_autoindex 中或在某些日志记录层间接抑制消息.

You could match the affected directories with e.g. RewriteRule and match against the trailing slash and return [F] or [G], which would be silent. Otherwise, it is not possible to suppress the message directly in mod_autoindex or indirectly at some logging layer.

这篇关于禁用“无法提供目录"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-20 00:33:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/972644.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   目录   quot

发布评论

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

>www.elefans.com

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