Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

windows 7 Hosts file...       www.test.com

httpd-vhosts file... MY-IP-IS-HERE is my actual 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

For some reason, when I go to test.com or www.test.com it loads E:/Web Server/xampp/htdocs/ instead of loading E:/Web Server/xampp/htdocs/test/ajaxblog and I cannot figure out how to get virtual host to load anything deeper then my root directory. Am I doing something wrong? I am using Apache or Xampp on Windows 7

share|improve this question
What does your error/access log say ? –  Iain Jan 31 '11 at 12:18

2 Answers 2

up vote 1 down vote accepted

www.test.com doesn't work because you don't have a ServerAlias setup for www.test.com

share|improve this answer
hello I have added ServerAlias www.test.com but it still loads my root directory instead of root/test/ajaxblog any ideas? –  JasonDavis Jan 31 '11 at 11:17
You have quotes around your document root; Try removing them... –  Jacob Jan 31 '11 at 11:53
You need the quotes as you have spaces in your path. I don't think it is that. –  dunxd Jan 31 '11 at 12:25
Wasn't paying attention, your correct. –  Jacob Jan 31 '11 at 12:28

In addition to Jacobs answer on adding a ServerAlias www.test.com, you should restart Apache to make the change take effect. Make sure that you have not double ServerName test.com entries in your virtualhost configuration.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.