我希望apache2托管home.php
或我选择的任何内容作为起始页,而不是index.html
。我读到的所有内容都说要编辑httpd.conf
文件的DirectoryIndex
参数。我哪儿都没有那个文件。(我搜索了一下。)
默认情况下,我也没有.htaccess
文件。我创建了一个,并将行DirectoryIndex home.php
放在其中;然后我重新启动了apache。没有什么可懊恼的。
这在我的apache2.conf
文件中。
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
我不确定Options Indexes FollowSymLinks
做什么。
这些是我的/var/www/html/.htaccess
的文件内容。
<Directory /var/www/html>
DirectoryIndex home.php
</Directory>
当我将AllowOverride
更改为All
时,我收到一个服务器错误。
谢谢。
最好的方法是将DirectoryIndex添加到vhost配置中。
<Directory /foo>
DirectoryIndex home.php
Allow Override All
</Directory>
当你想在.htaccess
文件中使用该选项时,你必须在vhost配置中设置AllowOverride All
。否则,您的日志DirectoryIndex not allowed here
中会出现错误。