php 在windows下配置虛擬目錄的方法


1.先找到apache的配置文件 httpd.conf 找如如下代碼:

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

把# Include conf/extra/httpd-vhosts.conf 去掉#號,如下:

Include conf/extra/httpd-vhosts.conf

保存。

2.打開 Apache 的 conf 目錄下的  extra 文件夾下的  httpd-vhosts.conf 文件,用記事本打開,在末尾加入以下代碼:

 1 <VirtualHost *:80>
 2 ServerName www.mydemo.com
 3 DocumentRoot "D:/mydemo"
 4 <Directory "D:/mydemo">
 5 Options FollowSymLinks IncludesNOEXEC Indexes
 6 DirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.pl default.pl index.shtml
 7 AllowOverride Options FileInfo
 8 Order Deny,Allow
 9 Allow from all
10 </Directory>
11 </VirtualHost>

3.再到C:->Windows->System32->drivers->etc目錄,打開hosts文件。
在末尾添加如下代碼:

 1 127.0.0.1 www.mydemo.com 

然后再創建D:\mydemo目錄
再然后重啟一下apache服務器。
在瀏覽器輸入www.mydemo.com看看

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM