1.打开xampp安装目录:D:/xampp/apache/conf,找到文件httpd.conf,打开并查找“Virtual hosts” 确保下面一行没有##号,修改后保存.
2.打开D:/xampp/apache/conf/extra,找到文件httpd-vhosts.conf,打开并查找“NameVirtualHost”确保该行前面没有#号,再在末尾加入以下几行:
<VirtualHost *:80>
DocumentRoot /xampp/htdocs/123/bbs
ServerName www.hahachao.vicp.net
</VirtualHost>
DocumentRoot /xampp/htdocs/123/bbs
ServerName www.hahachao.vicp.net
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /xampp/htdocs/123/ucenter
ServerName www.hahachao.vicp.net
</VirtualHost>
DocumentRoot /xampp/htdocs/123/ucenter
ServerName www.hahachao.vicp.net
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /xampp/htdocs/
ServerName localhost
</VirtualHost>
DocumentRoot /xampp/htdocs/
ServerName localhost
</VirtualHost>
修改后保存。
3.重启Apache,在地址栏输入域名
www.myweb1.com 回车即可打开原来要输入路径才能打开的网页。