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

I have a server at home that I plan to use to host two websites using Apache, I bought two domains and made them go to my server IP, but the problem is that it only works for one of them, if I enter it goes to /domain1, if I enter it still goes to /domain1.

This is my configs for them, I did this by reading some tutorials and such.. Can you please explain what did I do wrong here?

<VirtualHost *:80>
DocumentRoot "C:\apache\htdocs\domain1"

<VirtualHost *:80>
DocumentRoot "C:\apache\htdocs\domain2"
share|improve this question
Is this all what you have in your server config with regard to virtual hosts? – Khaled Jan 10 '12 at 8:45
Yes, everything else is not changed – Stan Jan 10 '12 at 8:47
Do you have a single or multiple IPs assigned to these two names? – Khaled Jan 10 '12 at 8:51
Don't understand this one. My server has 1 IP, so both domains are linked to it. Single I guess, but don't really understand the question. – Stan Jan 10 '12 at 8:53
Have a look at this page. It may help you. – Khaled Jan 10 '12 at 8:56
up vote 3 down vote accepted

You should add

NameVirtualHost *:80

line above the VirtualHost sections

Save httpd.conf and restart httpd

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.