1.找到"conf/httpd.conf" 文件
2.在httpd.conf裏面加了如下語句
Alias /anstyla "E:/anstyla/src/web"
<Directory "E:/anstyla/src/web">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
在此模塊下建立虛擬目錄,Alias /虛擬目錄名稱/ "虛擬目錄路徑,以[/]代替[/]"
例如:Alias /admin "D:/web/admin/"
(*)/admin 爲虛擬目錄名稱,一般不用在名稱後加"/",若加入,每次都要在虛擬目錄後輸入"/"才能訪問網站;D:/web/admin/ 爲虛擬目錄的物理路徑.
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 /anstyla "E:/anstyla/src/web"
<Directory "E:/anstyla/src/web">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
DirectoryIndex default.php
</Directory>
=====================================================
Apache 用的少,怎麼設置虛擬目錄和默認頁面老是忘了,今天記下先.