一、修改httpd.conf文件
编辑配置文件:目录:%xampp\apache\conf\httpd.conf#确认以下是否开启Include conf/extra/httpd-vhosts.conf#修改参数 #AllowOverride none #Require all denied Options All AllowOverride All Require all granted
#配置文本最后加入:
<Directory "D:/web/web1"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all</Directory><Directory "D:/web/web2"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all</Directory>二、配置虚拟目录
编辑配置文件:目录:%xampp\apache\conf\extra\httpd-vhosts.conf#加入以下内容:ServerAdmin web1@dummy-host2.example.com DocumentRoot "D:/web/web1" ServerName www.web1.com ErrorLog "logs/web1-error.log" CustomLog "logs/web1-access.log" common ServerAdmin web2@dummy-host2.example.com DocumentRoot "D:/web/web2" ServerName www.web2.com ErrorLog "logs/web2-error.log" CustomLog "logs/web2-access.log" common