Webmasters Stack Exchange is a question and answer site for pro webmasters. 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 want to run 2 websites. One for www.example.com, and the other for everything else (www.example2.com, www.example3.com)

How I do it?

I tried:

<virtualhost *:80>
ServerName www.example.com
#no server name

But I ALWAYS get the second website. Thank you.

share|improve this question

The default host that is the one that is first

# Default host (must be first)
<virtualhost *:80>    
    # I use localhost.localdomain, but any host name not matching later hosts gets handled here
    Servername localhost.localdomain
    DocumentRoot /home/www/default_site
<virtualhost *:80>
    ServerName www.example.com
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.