“目录索引被规则禁止”是什么意思?意思是?

发布于 2024-10-18 09:37:58 字数 1072 浏览 8 评论 0原文

下面这行是什么意思?

[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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

流年里的时光 2024-10-25 09:37:58

编辑2:好吧...我想我一开始完全误读了这个问题。你说目录中没有 index.php 文件?如果是这样,DirectoryIndex index.php /index.php 看起来不正确。也许你应该尝试将其更改为:

DirectoryIndex home.php

我是否正确理解了这个问题?您正在尝试显示目录​​的默认页面,对吗?


默认情况下,一些 http.conf 设置具有以下规则:

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

每当我设置虚拟主机时,我经常更改此规则以使其看起来更像这样:

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Allow from all
</Directory>

您的情况中的重要部分是最后两部分 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:

DirectoryIndex home.php

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:

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

Whenever I set up a vhost, I often change this rule to look more like this:

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Allow from all
</Directory>

The important parts in your case are the last two pieces Order and Allow.

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?

琉璃繁缕 2024-10-25 09:37:58

检查您的条目并确保您站点的虚拟主机 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文