after messing around a while I decided to ask here:
I have a vhost and want to use 2 domains on this server. My apache configuration file looks something like this:
NameVirtualHost *
ServerName www.domain1.de
DocumentRoot /var/www/folder1/
ServerName www.domain2.de
DocumentRoot /var/www/folder2/
On the configuration page for the domains of my vhost both domains assigned to the server ip.
The problem now is:
- www.domain1.de works
- domain1.de works
- www.domain2.de works
- domain2.de does not work
Has any one any idee why the second domain only works with the added "www"?
Answer
domain1.de
works because www.domain1.de
is the first VirtualHost
and is served as default. You need to add ServerAlias domain2.de
to www.domain2.de
for the shorter version to work as well (you should add ServerAlias
for www.domain1.de
too).
If you don't want www.domain1.de
to be served as default add another VirtualHost
at the begining serving some simple HTML file.
Comments
Post a Comment