1 首先在D:\wamp\bin\apache\Apache2.2.21\conf找到httpd.conf文件打開然後大概在460多行找到 去掉#,然後就是下面的情況 # Virtual hosts Include conf/extra/httpd-vhosts.conf 2 然後在打開D:\wamp\bin\apache\Apache2.2.21\conf\extra中的httpd-vhosts.conf文件 在文件的末尾加上 <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "d:/wamp/www/4/huaguoshan" ServerName www.hgs2013.cn ErrorLog "logs/dummy-host3.example.com-error.log" CustomLog "logs/dummy-host3.example.com-access.log" common </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "d:/wamp/www/test" ServerName www.test.cn ErrorLog "logs/dummy-host4.example.com-error.log" CustomLog "logs/dummy-host4.example.com-access.log" common </VirtualHost> 寫入自己想要的域名。 3 最後打開C:\Windows\System32\drivers\etc中的hosts文件 在文件的最後面把剛才定義的域名給指定一下 127.0.0.1 www.hgs2013.cn 127.0.0.1 www.test.cn 這樣就OK了,純屬個人見解