2

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.

1 Answer 1

2

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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