How to route defines in Magento 2

We use the routes.php to define route in Magento for Frontend and Adminhtml area. You have need to define frontname in routes.xml file. After that, you need the controller in your custom extension.

You can use the same front name to hit the different controller names.


<?xml version="1.0"?>
<!--
/**
 * my moudle
 *
 
 *
 */-->   
<config 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
  <router id="standard">
    <route id="fistparameterofurl" frontName="fistparameterofurl">
      <module name="my_module" />
    </route>
  </router>
</config>


admin

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top