.htaccess被应用到错误的域

我已经configuration我的Apache这样的:

<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> 

我在/ var / www / html / th3falc0n中有一个.htaccess,它将th3falc0n.deredirect到th3falc0n.de/p/home和其他一些东西。 但是,这些规则也适用于lolhens.org,这不是预期的行为。 我的错是什么? 我怎样才能实现.htaccess只适用于th3falc0n.de?

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 

由于我有多个build议将.htaccess内容移动到站点configuration中:这不是一个选项,因为pipe理lolhens.org的用户不能访问服务器configuration,但可以使用.htaccess,我想保留这个一致的所有可能的用户。

编辑:

发现后, http://www.lolhens.org没有.htaccess的问题,但它会发生在http://lolhens.org我尝试了另一个configuration像这样:

 <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> 

但是这仍然有相同的结果。 www.lolhens.org按预期工作,lolhens.org没有。

如果来自www.lolhens.org的任何内容是从/ var / www / html / th3falc0n提供的,那么即使用户要求不同的域名,那么.htaccess文件也会被尊重。

Iain是正确的:因为你显然有权访问configuration文件,最简单的解决scheme是删除.htaccess文件,将其指令移动到www.th3falc0n.de的VirtualHost中,并通过设置AllowOverride none禁用.htaccess。 请参阅Apache htaccess文件教程 。

我只知道,这个错误是我的本地浏览器的caching,它保存了lolhens.org的redirect。 第二个configuration现在可以工作。