ps.在创建多个虚拟主机时,也需要新建一个文件夹包含你的项目全部内容如magento2和test,如果还需要创建则再创建相应文件夹。
2.找到你的xampp安装目录,依次打开以下目录:apache/conf/extra目录找到httpd-vhosts.conf文件,用记事本打开。
3.打开http-vhosts.conf后,在最下面添加如下代码:
servername www.magento2.com documentroot d:/xampp/htdocs/magento2 options followsymlinks includesnoexec indexes directoryindex index.html index.htm index.php allowoverride all order deny,allow allow from all require all granted servername www.test.com documentroot d:/xampp/htdocs/test options followsymlinks includesnoexec indexes directoryindex index.html index.htm index.php allowoverride all order deny,allow allow from all require all granted
4.此外,需要配置c盘host文件,依次找到下面的目录:c盘/windows/system32/drivers/etc目录,找到hosts文件,用记事本打开,添加127.0.0.1 www.magento2.com 保存,如:
127.0.0.1 www.magento2.com127.0.0.1 www.test.com
5.配置虚拟主机完成,重启xampp集成环境即可。
以上就介绍了xampp配置虚拟主机具体步骤,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。