【发布时间】:2011-09-24 11:18:28
【问题描述】:
我使用 apache2 来托管一个站点。我的目录里有index.html和index.php。
我打开/etc/apache2/apache2.conf并添加一行:
DirectoryIndex index.php index.html index.htm
然后重启apache2。但是当我打开localhost/~username 时,它会访问 index.html。
我环顾四周,但找不到问题。我的 httpd.conf 是空的,我没有 .htaccess 文件。
设置可能隐藏在哪里?
编辑:我修改/etc/apache2/mods-availiable/dir.conf后,找到了index.php。
但是为什么 apache2.conf 不能覆盖 dir.conf?!
【问题讨论】:
-
如果您暂时从目录中删除 index.html(例如重命名),它会找到 index.php 吗?
-
是的。如果我将它重命名为 index.htm,apache 会找到 index.php
-
您找到解决方案了吗?我有完全相同的问题,如果我编辑 dir.conf 文件,它可以工作,但在其他任何地方(htaccess 除外),它都不会覆盖它:(