I am trying to rewrite url in routes.php with magento 2.2.2 version. url key is dynamically set from configuration. got this error :: Front controller reached 100 router match iterations

$urlKey = trim($this->scopeConfig->getValue('section/group/url_key', $storeScope), '/');
            $identifier = trim($request->getPathInfo(), '/');
            if ($identifier == $urlKey) {
                $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $identifier);
            } else {
                return false;
            return $this->actionFactory->create(
                ['request' => $request]
  • yes @ManthanDave i have overrides Router.php Commented Jan 3, 2018 at 7:25

1 Answer 1


This issue come because Mach condition check infinite the solution is

public function match(\Magento\Framework\App\RequestInterface $request)
    if($request->getModuleName() == 'search'){

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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