本机设置两个虚拟路径分别为 www.test.com www.mydome.com
首先要配置下Apache配置文件 httpd-vhosts.conf
# Virtual Hosts
#
<VirtualHost *:80>
ServerName www.test.com
ServerAlias www.test.com
DocumentRoot H:/wamp/www/test
<Directory "H:/wamp/www/test/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.mydome.com
ServerAlias www.mydome.com
DocumentRoot H:/wamp/www/mydome
<Directory "H:/wamp/www/mydome/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#
其次设置C:->windows->system32->drivers->etc->hosts文件
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.2 www.test.com
127.0.0.3 www.mydome.com
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost