首页 > 解决方案 > 多个网站无限 index.php 循环

问题描述

我正在尝试在同一个域中发送不同的 Symfony 网站。实际上,我每个人都有 1 个文件夹,例如:

html/site1
html/site2
html/...

这是 .conf (CentOS & Apache):

AliasMatch "^/site1(.*)" "/var/www/html/site1/public"
<VirtualHost *:80>
    ServerName example.com
    ServerAlias https://example.com

    DocumentRoot /var/www/html/site1/public
    <Directory /var/www/html/site1/public>
        AllowOverride All
        Order Allow,Deny
        Allow from All

        <IfModule mod_rewrite.c>
            Options -MultiViews
            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*)$ index.php [QSA,L]
        </IfModule>
    </Directory>
    ErrorLog /etc/httpd/conf.d/site1.log
</VirtualHost>

AliasMatch "^/site2(.*)" "/var/www/html/site2/public"
<VirtualHost *:80>
    ServerName example.com
    ServerAlias https://example.com

    DocumentRoot /var/www/html/site2/public
    <Directory /var/www/html/site2/public>
        AllowOverride All
        Order Allow,Deny
        Allow from All

        <IfModule mod_rewrite.c>
            Options -MultiViews
            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*)$ index.php [QSA,L]
        </IfModule>
    </Directory>
    ErrorLog /etc/httpd/conf.d/site2.log
</VirtualHost>

AliasMatch 似乎工作,但我得到一个无限循环,结果是:

example.com/siteX/index.php/index.php/index.php/index.php/index.php/index.php/... ERR_TOO_MANY_REDIRECTS

即使我从站点获得响应,服务器似乎也在尝试重定向我,因为日志正在写入,好像一切正​​常。

标签: apachecentos

解决方案


推荐阅读