【发布时间】:2016-03-16 23:28:49
【问题描述】:
您好,我正在做一个项目,我在根目录上有两个索引文件,一个是 index.php,另一个是 index.html。我想将默认页面设置为 index.php,如果它不可用,那么它应该适用于 index.html。 我在互联网上搜索了很多,并找到了以下解决方案。
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。
简而言之,我们可以说首选项不起作用。
【问题讨论】:
标签: php html apache .htaccess directoryindex