From :
/* Author : Andrew.Wu [ Created on : 2009/05/09 ]
*/ 使用xampp时,一开始都会偷懒将项目放在 htdocs 下,省时省事。但这样做却会有小小问题,项目没有跟文档等放在同一项目文件夹下,管理起来显得不直观,麻烦。那该如何达到这个效果? 一、本机DNS解析实现 修改windows的hosts C:/WINDOWS/system32/drivers/etc/hosts 127.0.0.1 localhost 127.0.0.1 test 二、注释掉一些语句 D:/xampp170/apache/conf/httpd.conf #ServerAdmin admin@localhost #ServerName localhost:80 #DocumentRoot "D:/xampp170/htdocs" 三、httpd-vhosts.conf 查看 apache/conf/httpd.conf 可以发现有下面语句 # Virtual hosts Include conf/extra/httpd-vhosts.conf 可见只要修改这个文件即可,这样也就免了把httpd.conf文件改得乱糟糟 # <Directory "D:/work/testprj/web"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> <VirtualHost *:80> DocumentRoot D:/work/testprj/web ServerName test </VirtualHost> # <VirtualHost *:80> DocumentRoot D:/xampp170/htdocs ServerName localhost </VirtualHost>