重定向循环 - Apache

重定向循环 - Apache

我正在努力弄清楚为什么我的 apache 配置会出现无限重定向循环。我尝试了所有方法,但循环仍然存在。

有趣的是,当您用 app_dev.php 替换最后的重定向(app.php)时,它可以正常运行(Symfony Dev 环境),但是用 app.php 替换它会导致循环。

我看了代码,但不知道那是什么。有什么线索吗?

<VirtualHost 178.62.109.124:8080>

ServerName messpace.com
ServerAlias www.messpace.com
ServerAdmin [email protected]
DocumentRoot /home/admin/web/messpace.com/public_html
ScriptAlias /cgi-bin/ /home/admin/web/messpace.com/cgi-bin/
Alias /vstats/ /home/admin/web/messpace.com/stats/
Alias /error/ /home/admin/web/messpace.com/document_errors/
#SuexecUserGroup admin admin
CustomLog /var/log/apache2/domains/messpace.com.bytes bytes
CustomLog /var/log/apache2/domains/messpace.com.log combined
ErrorLog /var/log/apache2/domains/messpace.com.error.log
<Directory /home/admin/web/messpace.com/public_html>
    AllowOverride All
    Options +Includes -Indexes +ExecCGI
</Directory>
<Directory /home/admin/web/messpace.com/stats>
    AllowOverride All
</Directory>

<IfModule mod_ruid2.c>
    RMode config
    RUidGid admin admin
    RGroups www-data
</IfModule>
<IfModule itk.c>
    AssignUserID admin admin
</IfModule>

#IncludeOptional /home/admin/conf/web/apache2.messpace.com.conf*


Alias /sf /$data_dir/symfony/web/sf
RewriteEngine On
# Rewrite assets path
RewriteRule ^/?images/(.*)$ /web/images/$1  [L]
RewriteRule ^/?css/(.*)$ /web/css/$1  [L]
RewriteRule ^/?js/(.*)$ /web/js/$1  [L]
RewriteRule ^/?font-awesome/(.*)$ /web/font-awesome/$1  [L]
RewriteRule ^/?fonts/(.*)$ /web/fonts/$1  [L]
RewriteRule ^/?bower_components/(.*)$ /web/bower_components/$1  [L]
RewriteRule ^/web/app.php - [L]
ErrorLog /var/log/apache2/domains/messpace.com.error.log
#SuexecUserGroup admin admin
CustomLog /var/log/apache2/domains/messpace.com.bytes bytes
CustomLog /var/log/apache2/domains/messpace.com.log combined
LogLevel warn rewrite:trace8
<Directory /home/admin/web/messpace.com/public_html>
    AllowOverride All
    Options +Includes -Indexes +ExecCGI -MultiViews     +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>
<Directory /home/admin/web/messpace.com/stats>
    AllowOverride All
</Directory>
<IfModule mod_ruid2.c>
    RMode config
    RUidGid admin admin
    RGroups www-data
</IfModule>
# IncludeOptional /home/admin/conf/web/apache2.messpace.com.conf*
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On

# Explicitly disable rewriting for front controllers
RewriteRule ^/web/app_dev.php - [L]

RewriteRule ^/web/app.php - [L]
# Fix the bundles folder
RewriteRule ^bundles/(.*)$ /web/bundles/$1  [QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/web/app.php

# Change below before deploying to production
#RewriteRule ^(.*)$ /web/app_dev.php [QSA,L]
RewriteRule  ^(.*)$ /web/app.php [QSA,L]

有什么想法吗?谢谢!

答案1

我已经在我的 Apache 上尝试了您的规则,它们按预期工作。也许您的设置中还有更多来自 conf.d 或 .htaccess 的规则?

相关内容