Site icon Sudhanshu's Blog

What is necessary to create a custom URL structure in Magento 2?

<type name="Magento\Framework\App\RouterList">
    <arguments>
        <argument name="routerList" xsi:type="array">
            <item name="%name%" xsi:type="array">
                <item name="class" xsi:type="string">%classpath%</item>
                <item name="disable" xsi:type="boolean">false</item>
                <item name="sortOrder" xsi:type="string">%sortorder%</item>
            </item>
        </argument>
    </arguments>
</type>

Standard router

A Magento URL that uses the standard router has the following format:

<store-url>/<store-code>/<front-name>/<controller-name>/<action-name>

Where:

The standard router parses this URL format and matches it to the correct controller and action.

Exit mobile version