Back to Top

What if id and frontName are different in routes.xml in Magento 2

Updated 7 August 2021

As we already know the use of routes.xml configuration file in Magento 2 but today we will learn about how it works.

Let’s take an example:

<?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="custom_blog_manager" frontName="blog">
            <module name="Webkul_BlogManager" />
        </route>
    </router>
</config>

Mostly we use the same value for id and frontName but what if we use different values like in the above example, first we need to know the working of these.

  1. id : it is used to create controller layout files, Magento identify the layout file which is store in view/[area]/layout/

    Page Layout handlers are having name like
    custom_blog_manager_blog_indxe.xml
    custom_blog_manager_blog_view.xml
  1. frontName: it is used just after the base url, module’s controller url’s are identify by the frontName value.

    Controller url’s are created like
    blog/blog/index
    blog/blog/view
    blog/blog/save

Start your headless eCommerce
now.
Find out More
. . .

Leave a Comment

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


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home