I have configured my apache like this:
<VirtualHost *:80>
ServerName www.th3falc0n.de
ServerAlias th3falc0n.de *.th3falc0n.de
DocumentRoot /var/www/html/th3falc0n
<Directory /var/www/html/th3falc0n>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.lolhens.org
ServerAlias lolhens.org *.lolhens.org
DocumentRoot /var/www/html/lolhens
<Directory /var/www/html/lolhens>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
I have a .htaccess in /var/www/html/th3falc0n which redirects th3falc0n.de to th3falc0n.de/p/home and some other stuff. However, those rules get also applied to lolhens.org, which is not the expected behaviour. What is my fault? How can I achieve that the .htaccess only applies for th3falc0n.de?
Output of apache2ctl -S
root@v36448:~# apache2ctl -S
VirtualHost configuration:
*:80 is a NameVirtualHost
default server www.th3falc0n.de (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost www.th3falc0n.de (/etc/apache2/sites-enabled/000-default.conf:1)
alias th3falc0n.de
wild alias *.th3falc0n.de
port 80 namevhost www.lolhens.org (/etc/apache2/sites-enabled/000-default.conf:15)
alias lolhens.org
wild alias *.lolhens.org
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
As I got multiple suggestions to move the .htaccess contents into the site configuration: This is not an option, as the user managing lolhens.org must have no accesss to the server configuration but be able to use .htaccess and I want to keep this consistent over all possible users.
EDIT:
After finding out, that http://www.lolhens.org doesn't have the issue with .htaccess, but it will occur on http://lolhens.org I tried another config like this:
<VirtualHost *:80>
ServerName th3falc0n.de
ServerAlias *.th3falc0n.de
DocumentRoot /var/www/html/th3falc0n
<Directory /var/www/html/th3falc0n>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName lolhens.org
ServerAlias *.lolhens.org
DocumentRoot /var/www/html/lolhens
<Directory /var/www/html/lolhens>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
This however still has the same result. www.lolhens.org works as expected, lolhens.org doesn't.
AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/sites-enabled/000-default.conf: