Apache中的虚拟主机可以加载任何目录吗?

Windows 7主机文件…

127.0.0.1 www.test.com 

httpd-vhosts文件… MY-IP-IS-HERE是我的实际IP …

 NameVirtualHost MY-IP-IS-HERE <VirtualHost MY-IP-IS-HERE> ServerName test.com DocumentRoot "E:/Web Server/xampp/htdocs/test/ajaxblog" DirectoryIndex index.php index.html index.html index.htm index.shtml </VirtualHost> 

由于某种原因,当我去test.com或www.test.com它加载E:/ Web服务器/ xampp / htdocs /而不是加载E:/ Web服务器/ xampp / htdocs /testing/ ajaxblog ,我无法弄清楚如何让虚拟主机加载任何更深,然后我的根目录。 难道我做错了什么? 我在Windows 7上使用Apache或Xampp

除了Jacobs回答添加ServerAlias www.test.com ,你应该重新启动Apache以使更改生效。 确保您的虚拟主机configuration中没有双倍的ServerName test.com条目。