{"id":300360,"date":"2021-08-07T13:13:51","date_gmt":"2021-08-07T13:13:51","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=300360"},"modified":"2021-08-07T13:15:15","modified_gmt":"2021-08-07T13:15:15","slug":"what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/","title":{"rendered":"What if id and frontName are different in routes.xml in Magento 2"},"content":{"rendered":"\n<p>As we already know the use of routes.xml configuration file in Magento 2 but today we will learn about how it works.<\/p>\n\n\n\n<p>Let&#8217;s take an example:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=&quot;1.0&quot;?&gt;\n&lt;config xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;urn:magento:framework:App\/etc\/routes.xsd&quot;&gt;\n    &lt;router id=&quot;standard&quot;&gt;\n        &lt;route id=&quot;custom_blog_manager&quot; frontName=&quot;blog&quot;&gt;\n            &lt;module name=&quot;Webkul_BlogManager&quot; \/&gt;\n        &lt;\/route&gt;\n    &lt;\/router&gt;\n&lt;\/config&gt;<\/pre>\n\n\n\n<p>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.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>id : it is used to create controller layout files, Magento identify the layout file which is store in view\/[area]\/layout\/<br><br>Page Layout handlers are having name like<br>custom_blog_manager_blog_indxe.xml<br>custom_blog_manager_blog_view.xml<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\"><li>frontName: it is used just after the base url, module&#8217;s controller url&#8217;s are identify by the frontName value.<br><br>Controller url&#8217;s are created like<br>blog\/blog\/index<br>blog\/blog\/view<br>blog\/blog\/save<\/li><\/ol>\n","protected":false},"excerpt":{"rendered":"<p>As we already know the use of routes.xml configuration file in Magento 2 but today we will learn about how it works. Let&#8217;s take an example: 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 <a href=\"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":278,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-300360","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What if id and frontName are different in routes.xml in Magento 2 - Webkul Blog<\/title>\n<meta name=\"description\" content=\"Webkul Blog What if id and frontName are different in routes.xml in Magento 2 -\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What if id and frontName are different in routes.xml in Magento 2 - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Webkul Blog What if id and frontName are different in routes.xml in Magento 2 -\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-07T13:13:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-07T13:15:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ajay Saini\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ajay Saini\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/\"},\"author\":{\"name\":\"Ajay Saini\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/de1e286f088fa4685b7aa35a195aaec0\"},\"headline\":\"What if id and frontName are different in routes.xml in Magento 2\",\"datePublished\":\"2021-08-07T13:13:51+00:00\",\"dateModified\":\"2021-08-07T13:15:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/\"},\"wordCount\":136,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/\",\"url\":\"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/\",\"name\":\"What if id and frontName are different in routes.xml in Magento 2 - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"datePublished\":\"2021-08-07T13:13:51+00:00\",\"dateModified\":\"2021-08-07T13:15:15+00:00\",\"description\":\"Webkul Blog What if id and frontName are different in routes.xml in Magento 2 -\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What if id and frontName are different in routes.xml in Magento 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/de1e286f088fa4685b7aa35a195aaec0\",\"name\":\"Ajay Saini\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/303e2c7f003847fdfe428ba43ba862f47921dd2487e3a2a86be3bdbc9e286261?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/303e2c7f003847fdfe428ba43ba862f47921dd2487e3a2a86be3bdbc9e286261?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Ajay Saini\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/ajaysaini-magento958\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What if id and frontName are different in routes.xml in Magento 2 - Webkul Blog","description":"Webkul Blog What if id and frontName are different in routes.xml in Magento 2 -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/","og_locale":"en_US","og_type":"article","og_title":"What if id and frontName are different in routes.xml in Magento 2 - Webkul Blog","og_description":"Webkul Blog What if id and frontName are different in routes.xml in Magento 2 -","og_url":"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2021-08-07T13:13:51+00:00","article_modified_time":"2021-08-07T13:15:15+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png","type":"image\/png"}],"author":"Ajay Saini","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Ajay Saini","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/"},"author":{"name":"Ajay Saini","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/de1e286f088fa4685b7aa35a195aaec0"},"headline":"What if id and frontName are different in routes.xml in Magento 2","datePublished":"2021-08-07T13:13:51+00:00","dateModified":"2021-08-07T13:15:15+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/"},"wordCount":136,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/","url":"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/","name":"What if id and frontName are different in routes.xml in Magento 2 - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"datePublished":"2021-08-07T13:13:51+00:00","dateModified":"2021-08-07T13:15:15+00:00","description":"Webkul Blog What if id and frontName are different in routes.xml in Magento 2 -","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/what-if-id-and-frontname-are-different-in-routes-xml-in-magento-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"What if id and frontName are different in routes.xml in Magento 2"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/de1e286f088fa4685b7aa35a195aaec0","name":"Ajay Saini","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/303e2c7f003847fdfe428ba43ba862f47921dd2487e3a2a86be3bdbc9e286261?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/303e2c7f003847fdfe428ba43ba862f47921dd2487e3a2a86be3bdbc9e286261?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Ajay Saini"},"url":"https:\/\/webkul.com\/blog\/author\/ajaysaini-magento958\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/300360","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/278"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=300360"}],"version-history":[{"count":3,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/300360\/revisions"}],"predecessor-version":[{"id":300367,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/300360\/revisions\/300367"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=300360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=300360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=300360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}