Apache中虛擬目錄和默認首頁的設置
來源:程序員人生 發布時間:2013-10-29 23:50:54 閱讀次數:2594次
虛擬目錄
1.找到"conf/httpd.conf" 文件
2.在節點:<IfModule alias_module>里增加
Alias /aidd2008 "D:/php/web/aidd2008"
其中 aidd2008 是你想要訪問的虛擬目錄; D:/php/web/aidd2008 為物理路徑,以[/]代替[]"
我們就在</IfModule>后面接著加:
<Directory "D:/php/web/aidd2008">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
(*)aidd2008 為虛擬目錄名稱,一般不用在名稱后加"/",若加入,每次都要在虛擬目錄后輸入"/"才能訪問網站
Alias /gt "D:/PHP/gt"
<Directory "D:/PHP/gt">
<IfModule php5_module>
<Files "index.php">
php_admin_flag safe_mode off
</Files>
</IfModule>
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
3.重啟Apache
設置默認頁面
方法1 設置全局的:
<IfModule dir_module>
DirectoryIndex index.php index.php4 index.php3 index.cgi index.pl index.html index.htm index.shtml index.phtml default.php
</IfModule>
方法2 針對某一目錄可以這么設置:
Alias /aidd2008 "D:/php/web/aidd2008"
<Directory "D:/php/web/aidd2008">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
DirectoryIndex default.php
</Directory>
生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈