php 错误 - 选项指令禁止目录索引?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10365520/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error - Directory index forbidden by Options directive?
提问by antonpug
I have been working on this server for the entire semester and have not changed any configuration options - the directories/files I created a couple weeks ago are still accessible, however any new directories, even exact duplicate of old working directories don't let me access them - get error "Directory index forbidden by Options directive". What is causing this?
我整个学期都在这台服务器上工作并且没有更改任何配置选项 - 我几周前创建的目录/文件仍然可以访问,但是任何新目录,甚至旧工作目录的完全重复都不允许我访问它们 - 得到错误“选项指令禁止的目录索引”。这是什么原因造成的?
回答by John Conde
Looks like someone disabled directory listing in Apache. If you are allowed to override it with .htaccess just place an .htaccess file in your root web directory with this information:
看起来有人在 Apache 中禁用了目录列表。如果允许您使用 .htaccess 覆盖它,只需在您的根 Web 目录中放置一个 .htaccess 文件,其中包含以下信息:
Options +Indexes
回答by mark.inman
For me this was an issue with not simply having an index.html or index.php (depending on what is in the .htaccess file) file in a folder and trying to pull it's contents. Then again I was using php to read contents, not by command line like I assume you are. If you still have not found a solution try creating an index.(php,html) in the directory that you can't pull contents from.
对我来说,这是一个问题,不仅仅是在文件夹中包含 index.html 或 index.php(取决于 .htaccess 文件中的内容)文件并尝试提取其内容。然后我再次使用 php 来读取内容,而不是像我假设的那样通过命令行。如果您仍然没有找到解决方案,请尝试在您无法从中提取内容的目录中创建一个 index.(php,html) 。
回答by gk_2000
For me what helped was, walking thru the explanations in the httpd.conf file and making sure I am compliant. The below comment helped:
对我来说有帮助的是,通过 httpd.conf 文件中的解释并确保我符合要求。以下评论有帮助:
# The path to the end user account 'public_html' directory must be
# accessible to the webserver userid. This usually means that ~userid
# must have permissions of 711, ~userid/public_html must have permissions
# of 755, and documents contained therein must be world-readable.
# Otherwise, the client will only receive a "403 Forbidden" message.
I was trying to move the document root and I hadn't set up the right perms..
我试图移动文档根目录,但我没有设置正确的权限..
回答by StandDuPp
For me worked in Wordpress. Error was Forbidden access wp-admin. I created .htaccess with Options +Indexes content.
对我来说,在 Wordpress 工作过。错误是禁止访问 wp-admin。我用 Options +Indexes 内容创建了 .htaccess。
Thank you.
谢谢你。

