1、修改本机的hosts文件,文件位置 C:WindowsSystem32driversetchosts
2、打开Apache的安装目录,找到httpd.conf文件,分别去掉下面两行文字前面的#号。
LoadModule vhost_alias_module modules/mod_vhost_alias.so(启用apache的虚拟主机功能)
Include conf/extra/httpd-vhosts.conf (导入虚拟主机配置)
3、打开extra目录内的httpd-vhosts.conf文件,把默认的配置改为自己想要的目录和域名
############ manage #################
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/manage/"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/localhost-error_log"
</VirtualHost>
############ 7dd #################
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/7dd/"
ServerName test.7dd.com
ErrorLog "logs/localhost-error_log"
</VirtualHost>
4、如果出现403错误 修改httpd.conf 里的Directory 配置,如下
<Directory />
Options FollowSymLinks ExecCGI Indexes
AllowOverride all
Allow from all
#Require all denied
</Directory>