Mobile app version of vmapp.org
Login or Join
Margaret670

: How should I set the default virtualhost? 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

@Margaret670

Posted in: #Apache #HttpdConf #Virtualhost

I want to run 2 websites.
One for example.com, and the other for everything else (www.example2.com, example3.com)
How I do it?

I tried:

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


But I ALWAYS get the second website.
Thank you.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Margaret670

1 Comments

Sorted by latest first Latest Oldest Best

 

@Eichhorn148

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 example.com </virtualhost>

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme