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]
            );
1
  • yes @ManthanDave i have overrides Router.php Jan 3, 2018 at 7:25

1 Answer 1

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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