我希望apache2主機home.php
或任何我選擇的起始頁而不是index.html
。我讀過的所有東西都說要編輯httpd.conf
文件的參數DirectoryIndex
。我沒有任何文件。 (我搜索。)更改Apache默認索引文件
我也沒有默認的.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
我收到了服務器錯誤。
謝謝。
當您設置'.htaccess'文件時,不需要重新啓動Apache。你的指令'DirectoryIndex home.php'應該可以工作。你確定'httpd.conf'中的'AllowOverride'設置爲這個虛擬主機嗎? – D4V1D 2015-04-04 18:48:46
沒有httpd.conf – 2015-04-05 15:52:29
我用'DirectoryIndex home.php'替換了'Options Indexes FollowSymLinks'行來解決這個問題。 – 2015-04-05 16:39:03