0

I'm trying to wrap my head around why my apache configs give me an infinite redirect loop. I've tried everything but the loop is still there.

What's interesting is that when you replace the very last redirect (app.php) with app_dev.php, it runs fine (Symfony Dev environment), but replacing it with the app.php causes the loop.

I'm looking at the code and have no clue what that could be. Any clues?

<VirtualHost 178.62.109.124:8080>

ServerName messpace.com
ServerAlias www.messpace.com
ServerAdmin info@messpace.com
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]

Any ideas? Thanks!

Konrad
  • 15
  • 2

1 Answers1

1

I've tried your rules on my apache and they are working as intended. Maybe there are more rules from conf.d or from .htaccess in your setup?

Dmitry Ilyin
  • 573
  • 2
  • 5
  • Right in the button. There was an htaccess file that messed it up (a Symfony stock one). I was so sure that it was the conf file that I didn't even bother looking at htaccess. Thanks a ton for checking it. – Konrad Jun 20 '16 at 21:56