I have used below code in di.xml
<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">Custom\Catalog\Controller\Router</item>
<item name="disable" xsi:type="boolean">false</item>
<item name="sortOrder" xsi:type="string">50</item>
</item>
</argument>
</arguments>
</type>
But i am not able to call the funtion Custom\Catalog\Controller\Router also to tried to exit the code but unable to reach given controller. Can any one give me solution
Best Answer
Using "Magento\Framework\App\RouterList" we use the di.xml file in our module.
app/code/Vendor/Module/etc/di.xml
After that we need to create a CustomRouter class.
app/code/Vendor/Module/Controller/CustomRouter.php :
And finally you need to create a routes.xml file. app/code/Vendor/Module/etc/routes.xml: