一、配置HOST文件
首先在你的系统盘下windows/system32/drivers/etc/host
二、修改httpd.conf
需要开启httpd.conf的LoadModule rewrite_modulemodules/mod_rewrite.so
去掉Include conf/extra/httpd-vhosts.conf前的#注释
若更改APACHE默认网站根目录需要保持
DocumentRoot "D:AppServwww"和两处一致
三、配置httpd-vhosts.conf
NameVirtualHost 127.0.0.1:80
<VirtualHost web.shops.com:80>
DocumentRoot "D:AppServwwwshops"
ServerName web.shops.com
<Directory"D:AppServwwwshops">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
不过虚拟主机是目录式的,如要为index.php为导向转接,(所有的文件都通过mod_rewrite发送到这个文件)可在D:AppServwwwshops添加文件内容为:
RewriteEngine on
RewriteRule !/.(js|gif|jpg|png|css)$ index.php
文件名是.htaccess(注意这就是扩展名,可以利用dos命令rename实现)
四、重启APACHE