“目录索引被规则禁止”是什么意思?意思是?
下面这行是什么意思?
[Mon Feb 21 20:52:13 2011] [error] [client 66.249.71.150]
Directory index forbidden by rule: /var/www/vhosts/website.com/httpdocs/
我的根目录中没有index.php,因为我的索引是home.php,网站根文件是由.htaccess规则定义的:
我的.htaccess文件如下所示:
DirectoryIndex index.php /index.php
RewriteCond %{HTTP_HOST} ^website.com$
RewriteRule ^$ en/home [R=301,L]
...
非常感谢!
update1:
我无权访问虚拟主机配置文件,我在共享主机上,所以我的 /httpdocs/ 中只有 .htacces 这就是我所拥有的。我应该怎么办?我应该禁用 DirectoryIndex (无论如何我都不使用它,并且该网站工作正常!)我如何检查我是否有目录索引?
update2:
- 在浏览器中测试时,一切似乎都运行良好、快速且良好!
- 然而,在日志中,我看到了这一点:
[2011 年 2 月 27 日星期日 02:18:56] [错误] [客户端 66.249.71.81] 文件不 存在: /var/www/vhosts/website.org/httpdocs/index
与此页面顶部的第一个错误不同,这似乎是常规 404(我的 404 错误文档是我的主页,因此错误页面显示主页)
当我输入在“website.org”中,htaccess 规则确实可以重定向到默认页面 website.org/en/home,当我输入“websie.org/index”时,它会重定向到 website.org/en/home,所以这一切似乎工作正常,但我不知道这两个错误意味着什么“规则禁止目录索引...”
线索?谢谢!
What could the following line mean?
[Mon Feb 21 20:52:13 2011] [error] [client 66.249.71.150]
Directory index forbidden by rule: /var/www/vhosts/website.com/httpdocs/
I have no index.php in the root, since my index is home.php, website root file is defined by .htaccess rules:
My .htaccess file looks like this:
DirectoryIndex index.php /index.php
RewriteCond %{HTTP_HOST} ^website.com$
RewriteRule ^$ en/home [R=301,L]
...
Thanks very much!
update1:
I dont have access to the virtual host config files, im on shared hosting , so only .htacces in my /httpdocs/ thats all I have. What should I do? Should I jus disable DirectoryIndex (I dont use that anyways and the site works fine!) How can I check wether I have directory index or not?
update2:
- when testing in browser, all seem to work fine, fast and nicely!
- in log however, i see this:
[Sun Feb 27 02:18:56 2011] [error]
[client 66.249.71.81] File does not
exist:
/var/www/vhosts/website.org/httpdocs/index
Unlike the first error at the top of this page, this seems a regular 404 (my 404 error document is my home page, so error pages show the home)
When I type in 'website.org' the htaccess rule does goed job in redirecting to the default page website.org/en/home and when I type 'websie.org/index' it redirects to website.org/en/home so it all seems to work fine but i dons know what the two error means "Directory index forbidden by rule..."
Clues? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
编辑2:好吧...我想我一开始完全误读了这个问题。你说目录中没有
index.php
文件?如果是这样,DirectoryIndex index.php /index.php
看起来不正确。也许你应该尝试将其更改为:我是否正确理解了这个问题?您正在尝试显示目录的默认页面,对吗?
默认情况下,一些 http.conf 设置具有以下规则:
每当我设置虚拟主机时,我经常更改此规则以使其看起来更像这样:
您的情况中的重要部分是最后两部分
Order
和允许
。编辑1:实际上,在进一步研究此错误后,这甚至可能是权限问题。您能否仔细检查 Apache 是否具有对您尝试访问的目录的读取权限?
EDIT 2: Ok... I think I just completely misread this question at first. You say you don't have an
index.php
file in the directory? If so,DirectoryIndex index.php /index.php
doesn't look correct. Maybe you should try changing that to:Am I understanding the issue correctly? You're trying to display the default page for the directory, correct?
By default, some http.conf setups have the following rule:
Whenever I set up a vhost, I often change this rule to look more like this:
The important parts in your case are the last two pieces
Order
andAllow
.EDIT 1: Actually, after looking into this error a bit more, it's possible that this is even a permissions issue. Can you double-check that Apache has read access to the directory you're trying to access?
检查您的条目并确保您站点的虚拟主机 DocumentRoot 列在那里,否则 apache 将无法访问它。
Check your entries and make sure that your site's virtual host DocumentRoot is listed there, otherwise apache won't be able to get at it.