網上方法五花白門,特地記錄一下,須要的朋友自行拿去就好。apache
須要修改的文件:httpd.conf / httpd-vhosts.conf / hostside
對應路徑:ui
httpd.conf:wamp\bin\apache\Apache2.2.21\confspa
httpd-vhosts.conf:wamp\bin\apache\Apache2.2.21\conf\extra開發
hosts:c\Windows\System32\drivers\etcio
修改流程:配置
1,打開httpd.conf,約466行:#Include conf/extra/httpd-vhosts.conf,刪除#;方法
2,仍是httpd.conf,約188行:wamp
<Directory />
AllowOverride none
Require all denied
</Directory>hosts
改成:
<Directory />
AllowOverride none
Options None
Order allow,deny
Allow from all
</Directory>
3,打開httpd-vhosts.conf,在最下方空白處添加如下代碼(自行修改wamp安裝路徑):
<VirtualHost *:80>
DocumentRoot "d:/wamp/www/"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "d:/wamp/www2/"
ServerName www.www2.com
</VirtualHost>
4,最後一步:打開hosts文件,在最後一行下面添加如下代碼:
127.0.0.1 localhost
127.0.0.1 www.www2.com
重啓wamp以後,localhost與www2.com便可區分開發,多站點配置成功。