Apache mod_rewrite,.htaccess和虚拟主机冲突

时间:2012-12-21 12:27:07

标签: apache .htaccess mod-rewrite

我有2个这样的虚拟主机:

<VirtualHost *:80>
DocumentRoot /var/www/html/watermelon/hhgt/webroot
ServerName booking
#ErrorLog logs/booking-error_log
#CustomLog logs/booking-access_log common
<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>
</VirtualHost>

<VirtualHost *:5321>
    DocumentRoot /var/www/html/watermelon/ik/webroot
    ServerName hotspot.local
    ErrorLog logs/hotsppot.local-error_log
    CustomLog logs/hotsppot.local-access_log common
    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
</VirtualHost>

他们有相同的.htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

有时第一个vhost会加载第二个vhost index.php!

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

这可能是因为您在/ etc / apache2 / sites-available /

中使用了默认值

检查您是否正确设置了可用站点,并检查/ var / logs / apache2中的Apache日志