Monday, 26 August 2013

Domain and IP should have different DocumentRoot

Domain and IP should have different DocumentRoot

the Domain points to an IP / Server. But I like to have different
documentRoots if the server is accessed via IP or via Domain. Therefore I
build this configuration:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin foo@bar
DocumentRoot /var/www/localhost
<Directory /var/www/localhost>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin foo@bar
ServerName example.org
ServerAlias example.org
DocumentRoot /var/www/example.org
<Directory /var/www/example.org>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
The problem is that accessing the IP or the domain will lead to the same
page. What did I do wrong?

No comments:

Post a Comment