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]
);
Birjitsinh ZalaBirjitsinh Zala
asked Jan 3, 2018 at 7:13
-
yes @ManthanDave i have overrides Router.phpBirjitsinh Zala– Birjitsinh Zala2018年01月03日 07:25:17 +00:00Commented 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'){
return;
}
}
answered Jan 3, 2018 at 13:50
default