5

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->setModuleName('search')->setControllerName('index')->setActionName('index');
                $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $identifier);
            } else {
                return false;
            }
            return $this->actionFactory->create(
                'Magento\Framework\App\Action\Forward',
                ['request' => $request]
            );
  • yes @ManthanDave i have overrides Router.php – Birjitsinh Zala Jan 3 '18 at 7:25
3

This issue come because Mach condition check infinite the solution is

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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