Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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
</virtualhost>
<virtualhost>
#no server name
</virtualhost>

But I ALWAYS get the second website. Thank you.

share|improve this question
add comment

1 Answer

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>
<virtualhost *:80>
    ServerName www.example.com
</virtualhost>
share|improve this answer
add comment

Your Answer

 
discard

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.