How to solve “Front controller reached 100 router match iterations” error in Magento 2

Avatar image of Maarten Maarten
November 7, 2022
“Front controller reached 100 router match iterations”- this is an issue that few Magento 2 users will face. In this article, we’re going the discuss the problem, causes, solution, and debugging of this error. Let’s start.

If your site goes down multiple times a day and displays the message: “Front controller reached 100 router match iterations”. You can’t access admin and frontend once this happens. It’s just an error page that’s left.

nodFa CVMhCJPVrIrHs96OmD9IMYcEeneG1mKqlApTluhUl5UknNIXtWwltDrGJJEpJXe19MKBFzG0RU7txGLFMoJeFD8CgRFZys7YqJhk7534Hc44 6hj7ohz D23hOWNwFVSy9YxVEZFRDC1dYLt0 tTRzhHPC0wYYzcWuM7tst5FJkpO2pOsTWkjU

What are the Causes?

It happens when Magento cannot find a proper route. This is because the router starts making infinitive references for dispatching requests.

Normally, it matches a request with the router. In exceptional cases, Magento fails to create routers and shows this error– Front controller reached 100 router match iterations 

How to Debug?

In app/code/core/Mage/Core/Controller/Varien/Front.php inside of the dispatch() function. You will find the following code snippet:

while (!$request->isDispatched() && $i++<100) {
    foreach ($this->_routers as $router) {
        if ($router->match($this->getRequest())) {

Replace the code above with:

Mage::log('----Matching routers------------------------------');
Mage::log('Total ' . count($this->_routers) . ': ' . implode(', ', array_keys($this->_routers)));
while (!$request->isDispatched() && $i++<100) {
    Mage::log('- Iteration ' . $i);
    $requestData = array(
        'path_info' => $request->getPathInfo(),
        'module' => $request->getModuleName(),
        'action' => $request->getActionName(),
        'controller' => $request->getControllerName(),
        'controller_module' => $request->getControllerModule(),
        'route' => $request->getRouteName()
    $st = '';
    foreach ($requestData as $key => $val) {
        $st .= "[{$key}={$val}]";
    Mage::log('Request: ' . $st);
    foreach ($this->_routers as $name => $router) {
        if ($router->match($this->getRequest())) {
            Mage::log('Matched by "' . $name . '" router, class ' . get_class($router));

The error log to be generated var/log/system.log.

Or you can also add the following debug code to app / code / core / Mage / Core / Controller / Varien / Front.php: Line 183:

if ($i>100) {
        file_put_contents('/tmp/debug.txt', Mage::getConfig()->getNode()->asNiceXml());
               Mage::throwException('Front controller reached 100 router match iterations');


What is the Solution?

  • Change the admin URL in app/etc/local.xml to fix the problem if the error is found in the admin section. Replace urltoadmin value with the URL you want and your new admin URL should be:
  • CMS module disabled: 404 not found requests are handled by the CMS module, it is a fallback router. As the module is disabled, no router can be found. Simply try enabling the CMS module and check if the issue is solved.
  • The cache is corrupted: Magento cache corrupted– this error causes when the list of routers never gets loaded. It’s because it loads from the cache and since the cache is corrupted, it does not contain this data. Simply flushing the Magento cache will help you resolve this issue. To remove cache corruption, you can also delete the /var/ cache folder.

Other possible solutions:

When upgrading or moving Magento, some cases went wrong:  Front controller reached 100 router match iterations.

Fix this error SQL and run the following command:

SET FOREIGN_KEY_CHECKS=0; UPDATE `core_store` SET store_id =0 WHERE code='admin'; UPDATE `core_store_group` SET group_id =0 WHERE name='Default'; UPDATE `core_website` SET website_id =0 WHERE code='admin'; UPDATE `customer_group` SET customer_group_id =0 WHERE customer_group_code='NOT LOGGED IN'; SET FOREIGN_KEY_CHECKS=1;

I hope this solution will help you solve the issue.

Industry news straight to your inbox

Get the latest commerce news, trends, and strategies to grow your business
Subscribe to the newsletter
By submitting this form, you agree to receive promotional messages from Magstack. Unsubscribe any time by clicking the link in our emails.
Select location and language

Contact Our Sales Team

Learn more about our products, features, and pricing options.
By submitting this form, you agree to receive promotional messages from Shopify about its products and services. You can unsubscribe at any time by clicking on the link at the bottom of our emails.
Use cases
Log in
Start a free trial