Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Ok, I have added lines like:

Or some other domain that points to my routers IP, and is forwarded, but I get to the main site, but I want it to go to the subfolder I defined in my httpd-vhosts.conf:


 DocumentRoot "D:/Apps/xampp/htdocs/somedomain"

So, locally works, just remotely it goes to the root htdocs. So If I use a *:80 wildcard I works, but then everything points to the subfolder and all the other vhosts seem to get ignored.

Any Idea why this is?

share|improve this question
  1. DO NOT, ever, use hostnames in a VirtualHost definition. Use IP:80 or *:80.
  2. Domains are not "forwarded" - traffic is. What you put in your local hosts file has nothing to do with how remote traffic gets routed to your web server.

As always, the ServerName is decisive; the Host: header is compared with the ServerName, and if a matching vhost is found, that is who receives the request.

share|improve this answer
1. But then what IP do i put after NameVirtualHost? Just – TrySpace Apr 12 '12 at 15:14
2. So like I have it now it is OK? behind the ServerName? – TrySpace Apr 12 '12 at 15:15
You have that name resolving to localhost, so it's only attached to localhost traffic (why are you using the hosts file, by the way?). Change your vhost directives: NameVirtualHost *:80 and <VirtualHost *:80>. – Shane Madden Apr 12 '12 at 15:31
Thing is, i want to go to my root (it points to my modem/router), so I have it pointed to /htdocs, and the other, (also pointing to my router IP) I want to point to /somedomain.... – TrySpace Apr 13 '12 at 15:32
How is that related to how vhosts should be set up ? – adaptr Apr 13 '12 at 15:32

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.