I have used this url to change it but i am keeping getting the same erros https://magento.stackexchange.com/a/209478/96152
i have a custom routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="testurl" frontName="testurl">
<module name="Test_CustomRouter" />
</route>
</router>
</config>
I have added frontend/di.xml
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Framework\App\RouterList">
<arguments>
<argument name="routerList" xsi:type="array">
<item name="customrouter" xsi:type="array">
<item name="class" xsi:type="string">Test\CustomRouter\Controller\Router</item>
<item name="disable" xsi:type="boolean">false</item>
<item name="sortOrder" xsi:type="string">61</item>
</item>
</argument>
</arguments>
</type>
</config>
This is my controller for the router
class Router implements \Magento\Framework\App\RouterInterface {
/**
* @var \Magento\Framework\App\ActionFactory
*/
protected $actionFactory;
/**
* Response
*
* @var \Magento\Framework\App\ResponseInterface
*/
protected $_response;
/**
* @param \Magento\Framework\App\ActionFactory $actionFactory
* @param \Magento\Framework\App\ResponseInterface $response
*/
public function __construct(
\Magento\Framework\App\ActionFactory $actionFactory, \Magento\Framework\App\ResponseInterface $response
) {
$this->actionFactory = $actionFactory;
$this->_response = $response;
}
/**
* Validate and Match
*
* @param \Magento\Framework\App\RequestInterface $request
* @return bool
*/
public function match(\Magento\Framework\App\RequestInterface $request) {
$identifier = trim($request->getPathInfo(), '/');
if (strpos($identifier, 'newcustomurl') !== false) {
$request->setModuleName('customurl')->setControllerName('test')->setActionName('test');
} else {
return;
}
return $this->actionFactory->create(
'Magento\Framework\App\Action\Forward', ['request' => $request]
);
}
}
When i go to my frontent i get
Front controller reached 100 router match iterations
Please can i get some advice or where i am getting this wrong.