嗨,我正在一个项目,我有两个索引文件的根,一个是index.php和其他是index.html。我想o设置默认页面index.php,如果它不可用,那么它应该为index.html工作。 我在互联网上搜索了很多,并找到了以下解决方案。无法在apache2中设置默认索引页[Debian 7.1]
DirectoryIndex index.php index.html
我使用我的网站上这样的代码:
<Directory "/home/zhengyu/webroot/engine5g/rentown.com/">
DirectoryIndex index.php index.html default.htm
</Directory>
我也曾尝试另一种方式:
<Directory "/home/zhengyu/webroot/engine5g/rentown.com/">
DirectoryIndex index.php index.html
Options Indexes FollowSymLinks MultiViews
AllowOverride None
DirectoryIndex index.php index.html
Order allow,deny
allow from all
</Directory>
但他们没有工作,它总是让index.php文件默认,但是当它不可用时它不会加载index.html。
如果我先编写index.html然后index.php,然后加载index.html,但如果index.html不可用,则不加载index.php。
总之,我们可以说首选项不起作用。
我已经试过这个,但它不起作用 –
@Insomania你可以在这里粘贴你的htacess规则吗? – Suresh
@Insomania我认为你有路径问题'/ home/zhengyu/webroot/engine5g/rentown.com /';尝试改变它。 – Suresh