0

Am trying to use laravel to build a site but my routes all redirect to the homepage. Apache error logs show this

AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

And the .htaccess file is this

<IfModule mod_rewrite.c>
    Options -MultiViews
    Options +FollowSymLinks

    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

The webroot has multiple sub-folders which are document roots for different domains. Am working with one of these sub-folders.

What is causing this error and how can it be fixed

1 Answer 1

0

When a RewriteRule matches in a directory context (which a .htaccess file is) the resulting subsitution gets resubmitted in a sub request.

So what happens is that when you request "foo" it gets rewritten to index.php/foo this then gets resubmitted as a subreqeusts, matches again and gets rewritten to index.php/index.php/foo etc, until the maximum internal redirect limit is reached.

Why don't you use the .htaccess file that comes with laravel? This one uses:

<IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^index.php [L]
</IfModule>

And that should not lead to loops.

4
  • I used the default .htacess file and still had the same issue
    – MrFoh
    Jun 30, 2013 at 8:51
  • Can you tell us a bit more about your config? Is there an actualy index.php in the same directory where this .htaccess file is? Jun 30, 2013 at 8:55
  • Yes the .htaccess and index.php are in the same directory. /.htaccess /index.php /css /js /img
    – MrFoh
    Jun 30, 2013 at 8:59
  • 1
    Should there really be a space after the ^ in ^ index.php [L]?
    – Jenny D
    Jun 30, 2013 at 10:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .