Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

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.

share|improve this answer
    
I used the default .htacess file and still had the same issue –  MrFoh Jun 30 '13 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? –  Krist van Besien Jun 30 '13 at 8:55
    
Yes the .htaccess and index.php are in the same directory. /.htaccess /index.php /css /js /img –  MrFoh Jun 30 '13 at 8:59
1  
Should there really be a space after the ^ in ^ index.php [L]? –  Jenny D Jun 30 '13 at 10:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.