首先
1 编辑httpd.conf,查找Include conf/extra/httpd-vhosts.conf,把前面注释符号“#”删掉。
2 找到安装目录下wamp\bin\apache\Apache2.2.17\conf\extra 下 httpd-vhosts.conf这个文件
3 把 里面的内容清空掉 换成下面的内容
<VirtualHost 127.0.0.1:80>DocumentRoot E:/htdocs/dz
ServerName www.dz.com
<Directory "E:/htdocs/dz">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost 127.0.0.2:80>
DocumentRoot E:/htdocs/cms
ServerName www.dd.com
<Directory "E:/htdocs/cms">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost 127.0.0.3:80>
DocumentRoot E:/htdocs/dgcms
ServerName www.dg.com
<Directory "E:/htdocs/dgcms">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost 127.0.0.4:80>
DocumentRoot E:/htdocs/phpmyadmin
ServerName www.myadmin.com
<Directory "E:/htdocs/phpmyadmin">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
4 修改C:/WINDOWS/system3/drivers/etc/host这个文件,用记事本打开,加上如下内容:
127.0.0.1 www.maypp.com
5然后重启apache,在浏览器里面输入www.dd.com,看看访问到的内容