【问题标题】:Apache mod_rewrite, .htaccess and virtual hosts conflictsApache mod_rewrite、.htaccess 和虚拟主机冲突
【发布时间】:2012-12-21 12:27:06
【问题描述】:

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

有时第一个虚拟主机会加载第二个虚拟主机的 index.php!

有什么想法吗?

【问题讨论】:

  • 您在加载hotspot.local 时使用的端口是否正确。 IE。 http://hotspot.local:5321?

标签: apache .htaccess mod-rewrite


【解决方案1】:

这可能是因为您在 /etc/apache2/sites-available/ 中使用了默认值

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

【讨论】:

    猜你喜欢
    • 2010-10-22
    • 2018-04-29
    • 2013-12-16
    • 2010-11-02
    • 2012-12-09
    • 2019-12-04
    • 1970-01-01
    • 2014-08-17
    • 2015-11-29
    相关资源
    最近更新 更多