Request exceeded the limit of 10 internal redirects
To prevent infinite looping add an extra RewriteCond
line on top of your rule like this:
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
prevents looping by checking an internal mod_rewrite
variable REDIRECT_STATUS
which is set to 200 after first successful internal redirect.
Reference: Apache mod_rewrite Introduction
The last block:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
Is most likely re-injecting a changed request URI over and over again which could cause such an internal redirect error. Check the error log with debugging level enabled to trace each redirect step, it makes things much more visible and will tell you exactly which redirect rules are triggering it.
For a detailed description and how to prevent the re-injection, please see:
- Mod_Rewrite unexpected behavior L flag
The solution outlined there actually should do it in your case as well. It's pretty much the same, even the file-names are identical.
Looking to your htaccess I see that you use it to remove index.php
from your url, but you are missing the RewriteBase
, you can add it after the RewriteEngine On
directly like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
AddType image/x-windows-bmp bmp
So, RewriteBase /
will be valid if your application/website is not on a subdomain
. However, if it is then you might need to add the folder name after the /
symbol.