在httpd.conf文件的末尾添加如下代码,其中DocumentRoot为你的虚拟主机的根目录路径,ServerName为虚拟主机的域名,DirectoryIndex为重定向的指定的脚本。
<VirtualHost 127.0.0.1>
DocumentRoot "E:/Server/apache2.2/htdocs/xxx/"
ServerName xxx.com
DirectoryIndex index.php
<Directory "E:/Server/apache2.2/htdocs/xxx/">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
然后打开windows/system32/drivers/etc/hosts
在127.0.0.1 localhost后面添加代码
127.0.0.1 xxx.com重启服务器,就大功告成了
通过浏览器访问http://xxx.com