网上方法五花白门,特意记录一下,需要的朋友自行拿去就好。
需要修改的文件:httpd.conf / httpd-vhosts.conf / hosts
对应路径:
httpd.conf:wampinapacheApache2.2.21conf
httpd-vhosts.conf:wampinapacheApache2.2.21confextra
hosts:cWindowsSystem32driversetc
修改流程:
1,打开httpd.conf,约466行:#Include conf/extra/httpd-vhosts.conf,删除#;
2,还是httpd.conf,约188行:
<Directory />
AllowOverride none
Require all denied
</Directory>
改为:
<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即可区分开发,多站点配置成功。