默認首頁的配置:
第一種:直接修改apache服務器的配置文件./conf/httpd.conf中的DirectoryIndex,如:(項目web以index.php為首頁)
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
第二種:apache服務器的配置文件./conf/httpd.conf中DirectoryIndex默認不變為index.html,此時需要當前項目下增加一個index.html文件,文件的內容如下編輯:(項目web以index.php為首頁)
index.html文件的內容如下:
<meta http-equiv="refresh" content="0; url=index.php">
以上兩種方式,在地址欄中輸入http://localhost/web就可以直接訪問到index.php的頁面。
默認網站的配置:(項目以web為例)
第一種:直接修改apache服務器的配置文件./conf/httpd.conf中的DocumentRoot和Directory,如:
DocumentRoot "/usr/local/apache/htdocs/web"
<Directory "/usr/local/apache/htdocs/web">
第二種:不修改apache服務器的默認配置文件httpd.conf,而是,修改./htdocs/目錄下的index.html文件:
index.html文件的內容如下:
<meta http-equiv="refresh" content="0; url=/web">
以上兩種方式,在地址欄中輸入http://localhost就可以直接訪問到web項目的網站。