Y
Y
y0rker2014-11-17 13:27:13
Apache HTTP Server
y0rker, 2014-11-17 13:27:13

Why does htaccess give Request exceeded the limit of 10 internal redirects due to probable configuration error?

The situation is this:
I have a site on yii2. There is a subfolder frontend/web to which you need to set up a redirect from the site root.
.htaccess in site root:

<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    # Enable mod_rewrite
    RewriteEngine On
    RewriteBase /
    # Frontend redirect
    RewriteCond %{REQUEST_URI} ^(.*)$
    RewriteRule ^(.*)$ frontend/web/$1
</IfModule>

Here is a piece from the log:
212.224.112.72 - - [17/Nov/2014:13:44:26 +0300] [9015.devs.fragme.org/sid#7f065b92f688][rid#7f065bc81d28/initial] (3) [perdir /home/fragme/devs/9015/www/fragme/] strip per-dir prefix: /home/fragme/devs/9015/www/fragme/ -> 
212.224.112.72 - - [17/Nov/2014:13:44:26 +0300] [9015.devs.fragme.org/sid#7f065b92f688][rid#7f065bc81d28/initial] (3) [perdir /home/fragme/devs/9015/www/fragme/] applying pattern '^(.*)$' to uri ''
212.224.112.72 - - [17/Nov/2014:13:44:26 +0300] [9015.devs.fragme.org/sid#7f065b92f688][rid#7f065bc81d28/initial] (2) [perdir /home/fragme/devs/9015/www/fragme/] rewrite '' -> 'frontweb/web/'
212.224.112.72 - - [17/Nov/2014:13:44:26 +0300] [9015.devs.fragme.org/sid#7f065b92f688][rid#7f065bc81d28/initial] (3) [perdir /home/fragme/devs/9015/www/fragme/] add per-dir prefix: frontweb/web/ -> /home/fragme/devs/9015/www/fragme/frontweb/web/
212.224.112.72 - - [17/Nov/2014:13:44:26 +0300] [9015.devs.fragme.org/sid#7f065b92f688][rid#7f065bc81d28/initial] (2) [perdir /home/fragme/devs/9015/www/fragme/] trying to replace prefix /home/fragme/devs/9015/www/fragme/ with /
212.224.112.72 - - [17/Nov/2014:13:44:26 +0300] [9015.devs.fragme.org/sid#7f065b92f688][rid#7f065bc81d28/initial] (1) [perdir /home/fragme/devs/9015/www/fragme/] internal redirect with /frontweb/web/ [INTERNAL REDIRECT]
212.224.112.72 - - [17/Nov/2014:13:44:26 +0300] [9015.devs.fragme.org/sid#7f065b92f688][rid#7f065bc86290/initial/redir#1] (3) [perdir /home/fragme/devs/9015/www/fragme/] add path info postfix: /home/fragme/devs/9015/www/fragme/frontweb -> /home/fragme/devs/9015/www/fragme/frontweb/web/
212.224.112.72 - - [17/Nov/2014:13:44:26 +0300] [9015.devs.fragme.org/sid#7f065b92f688][rid#7f065bc86290/initial/redir#1] (3) [perdir /home/fragme/devs/9015/www/fragme/] strip per-dir prefix: /home/fragme/devs/9015/www/fragme/frontweb/web/ -> frontweb/web/
212.224.112.72 - - [17/Nov/2014:13:44:26 +0300] [9015.devs.fragme.org/sid#7f065b92f688][rid#7f065bc86290/initial/redir#1] (3) [perdir /home/fragme/devs/9015/www/fragme/] applying pattern '^(.*)$' to uri 'frontweb/web/'
212.224.112.72 - - [17/Nov/2014:13:44:26 +0300] [9015.devs.fragme.org/sid#7f065b92f688][rid#7f065bc86290/initial/redir#1] (2) [perdir /home/fragme/devs/9015/www/fragme/] rewrite 'frontweb/web/' -> 'frontweb/web/frontweb/web/'
212.224.112.72 - - [17/Nov/2014:13:44:26 +0300] [9015.devs.fragme.org/sid#7f065b92f688][rid#7f065bc86290/initial/redir#1] (3) [perdir /home/fragme/devs/9015/www/fragme/] add per-dir prefix: frontweb/web/frontweb/web/ -> /home/fragme/devs/9015/www/fragme/frontweb/web/frontweb/web/
212.224.112.72 - - [17/Nov/2014:13:44:26 +0300] [9015.devs.fragme.org/sid#7f065b92f688][rid#7f065bc86290/initial/redir#1] (2) [perdir /home/fragme/devs/9015/www/fragme/] trying to replace prefix /home/fragme/devs/9015/www/fragme/ with /
212.224.112.72 - - [17/Nov/2014:13:44:26 +0300] [9015.devs.fragme.org/sid#7f065b92f688][rid#7f065bc86290/initial/redir#1] (1) [perdir /home/fragme/devs/9015/www/fragme/] internal redirect with /frontweb/web/frontweb/web/ [INTERNAL REDIRECT]

Etc. Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
y0rker, 2014-11-17
@y0rker

The problem turned out to be in htaccess, which was located in /frontend/web
It was necessary to add

RewriteBase /

B
Boris Benkovsky, 2014-11-17
@benbor

Well, the error says "limit of 10 internal redirects reached" - the logs show that Apache endlessly adds 'frontweb/web/' -> 'frontweb/web/frontweb/web/' to your path. Since you need to redirect all requests, remove the RewriteCond %{REQUEST_URI} ^(.*)$ line altogether.
Or make it not return true when the internal redirect has already happened

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question