• Bilal Malik

What is the difference between frontname and id in routes.xml

We many see routes.xml file with the same name of frontname and id. what if it is both different?


<?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 frontName="hello" id="world">
            <module name="Bilal_HelloWorld"/>
        </route>
    </router>
</config> 

frontname is used in URL construction e.g) http://domain/hello/index/index this URL search routes.xml with the frontname hello. Once it reached the controller, the controller searches the specific layout with route id world (world_index_index.xml).

Simple formula: route frontname used in URL and route id used in the layout.

#frontend #layout #magento2 #route

3 views

Recent Posts

See All

What is requireJS AMD in Magento2

Simply we can say, below format is the AMD module. define(['jquery'] , function ($) { return function () {}; }); Module Vs AMD module 1. Javascript Module Pattern (function () { this.myGlobal =

©2020 by Bilal Usean. Proudly created with Wix.com