How to Fix the Magento Routers Infinite Loop
Why you’re getting this error
The most likely place that you’ll find this problem is at the Magento 404 page. When Magento cannot find a page then it redirects to the default 404 page, but if Magento cannot find the default 404 page, then it redirects to the default 404 page, but if…. You get the point. An infinite redirect in a software application happens when code circles back around to itself.
There are a few programs running on your web server that could be the cause of this problem. I’m going to go through each of the possible solutions with you. The following, is an example of the error report that Magento will output for this error.
Backtrace Report – What the error looks like
a:5:i:0;s:52:"Front controller reached 100 router match iterations";i:1;s:501:"#0 /app/code/core/Mage/Core/Controller/Varien/Front.php(179): Mage::throwException("Front controlle...")
#1 /app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#2 /app/Mage.php(684): Mage_Core_Model_App->run(Array)
#3 /index.php(87): Mage::run("", "store")
#4 main";s:3:"url";s:5:"/test";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";
Solution 1: Fixing the Apache Web Server
Apache is the program that actually creates the handshake between your server and the client’s computer. You can control Apache for your individual website by placing a .htaccess file within your Magento root folder. If this file has an error in it, then it’s most likely communicating the wrong information to Magento.
You’ll need to fix your .htaccess file. You should first attempt to locate a version of the .htaccess file that existed prior to this error appearing. If you cannot locate an older copy of the file, then I’ve provided you with a fresh .htaccess file from a v1.9.0.4 Magento Installation. This file should work just fine, no matter which version of Magento that you’re running.
Solution 2: Magento in a subdirectory
If you’re running Magento in a subdirectory, then the above solution is still required. Once you have a copy of an .htaccess file that you know is stable and will work for most installations, then you can go to work customizing it for your situation.
This solution is required if Magento is running in a subdirectory, but you don’t want that subdirectory to be visible in your urls. You will need to uncomment line 131 from the .htaccess file above. Of course, if Magento exists in a subdirectory with another name, then it will need to state the name of your subdirectory instead of “magento”.
Solution 3: Enable mod_rewrite
If you’ve attempted the solutions above and Magento is still showing 404 error pages, then delete the /var/cache directory.
If you’re still having the problem, then you will need to check and see if mod_rewrite is running on your server. To do this, rename your current .htaccess file and add the .htaccess file below. Once installed, navigate to /testing_mod_rewrite.html on your domain. If your website does not redirect you, then mod_rewrite is disabled and you will need to enable it.
To enable mod_rewrite, open the httpd.conf file in your Apache configuration directory. Make sure that the following line is active and not commented out.
LoadModule rewrite_module modules/mod_rewrite.so
Restart your Apache web server and test to see if mod_rewrite is enabled.
Solution 4: Enable HTACCESS usage
If none of the changes to your htaccess file seem to be accepted by your server, then you may need to enable htaccess usage. To find out if this is your problem I will normally type “Hello World” into the top of my htaccess file and upload it to the server. Such a blatant error should cause your server to throw a 500 error. If you server doesn’t throw this error, then most likely your htaccess file is being ignored.
To fix this problem, locate your apache.conf file and find:
AllowOverride None
change this line of code to:
AllowOverride All
Now test it again. Test to make sure that you’re receiving the 500 error, then test your Magento installation for the 404 redirect issue.
Solution 5: Create a No-Route CMS Page
It’s possible that the 404 page was deleted from your Magento CMS pages. Navigate to the CMS Pages within your Magento administrative area. Once there, you need to verify that the “404 Not Found” page exists. If this page does not exist, then go ahead and create it.

Solution 6: Specify The Proper 404 Page
Check that your Magento installation knows the default no-route url. Navigate to System > Configurations > Web > Default Pages and locate the input field for Default No-Route URL. Make sure that this value is set properly to the default value of cms/index/noRoute.

Solution 7: Can’t Find User Cookie
In some Magento installations this problem can be caused when Magento is unable to set a proper user cookie. A cookie is a small file that is saved to the users computer, so that Magento can remember the user next time they visit. Cookies are required when logging in to any website. If Magento is not setting the proper cookie for your server installation, then it could easily be mistranslated.
If you’re getting the “too many redirects” error when trying to log into the admin area, then try this solution.
Log into the Database that’s associated with your installation and locate the core_config_data table. Run the following SQL commands against your Magento database and then delete the var/cache file within your Magento files.
Alternative Solutions
On my way to solving this problem I came across a number of useful resources. Here are some of them.
If you found a different problem, with a different solution, please be sure to share it with the community in the comments below.
[Solved] Front controller reached 100 router match iterations