{"id":384603,"date":"2023-06-01T08:53:58","date_gmt":"2023-06-01T08:53:58","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=384603"},"modified":"2023-06-01T08:56:03","modified_gmt":"2023-06-01T08:56:03","slug":"how-to-create-custom-routes-adobe-commerce","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/","title":{"rendered":"How to create custom routes &#8211; Adobe Commerce"},"content":{"rendered":"\n<p>In this blog, We will learn how to create a custom router in Magento2.<\/p>\n\n\n\n<p>First of all, let&#8217;s discuss what is a <a href=\"https:\/\/developer.adobe.com\/commerce\/php\/development\/components\/routing\/\" target=\"_blank\" rel=\"noreferrer noopener\">router<\/a> in Magento2.<\/p>\n\n\n\n<p>A router is a PHP class that is used for matching and processing the URL request in the module.<\/p>\n\n\n\n<p>In other words, Routing defines a name for a module that we use in the URL<\/p>\n\n\n\n<p> to find the module and execute the controller action in Magento2.<\/p>\n\n\n\n<p>Now, let&#8217;s create the custom routes, first of all, we need to declare our router.<\/p>\n\n\n\n<p>To declare our route we have to create a <strong>routes.xml<\/strong> file on the following path:<\/p>\n\n\n\n<p><strong>&lt;magento-root-dir.&gt;<\/strong>\/<strong>app\/code\/Webkul\/Hello\/etc\/frontend<\/strong>\/<\/p>\n\n\n\n<p>Here we are taking an example, our vendor is  <strong>Webkul<\/strong> and the module name is <strong>Hello<\/strong><\/p>\n\n\n\n<p>In the <strong>routes.xml<\/strong> file, we define a route by using the &lt;route&gt; tag. it contains the following attributes:<\/p>\n\n\n\n<p><strong>Id:<\/strong> id is a unique string it will identify the route. we will use this string to create our layout handler for the action.<\/p>\n\n\n\n<p><strong>frontName<\/strong>:  frontName attribute is also a unique string that will be shown on the URL request.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=&quot;1.0&quot;?&gt;\n\n&lt;config xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;\n        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;routing&quot; frontName=&quot;routing&quot;&gt;\n            &lt;module name=&quot;Webkul_Hello&quot; \/&gt;\n        &lt;\/route&gt;\n    &lt;\/router&gt;\n&lt;\/config&gt;<\/pre>\n\n\n\n<p>After creating routes.xml, now declare the layout handler for our new route.<\/p>\n\n\n\n<p> To declare a layout handler we need to create a layout file <strong>routing_index_index.xml<\/strong><\/p>\n\n\n\n<p>on the following path.<\/p>\n\n\n\n<p><strong>&lt;magento-root-dir.&gt;<\/strong>\/<strong>app\/code\/Webkul\/Hello\/view\/frontend\/layout<\/strong>\/<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=&quot;1.0&quot;?&gt;\n\n&lt;page xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;\n        xsi:noNamespaceSchemaLocation=&quot;urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd&quot;&gt;\n    &lt;body&gt;\n        &lt;referenceBlock name=&quot;page.main.title&quot;&gt;\n            &lt;action method=&quot;setPageTitle&quot;&gt;\n                &lt;argument translate=&quot;true&quot; name=&quot;title&quot; xsi:type=&quot;string&quot;&gt;Custom Router Page&lt;\/argument&gt;\n            &lt;\/action&gt;\n        &lt;\/referenceBlock&gt;\n    &lt;\/body&gt;\n&lt;\/page&gt;<\/pre>\n\n\n\n<p>After declaring the layout handler, now let&#8217;s add our custom route into the<\/p>\n\n\n\n<p><strong>\\Magento\\Framework\\App\\RouterList class.<\/strong><\/p>\n\n\n\n<p>To declare a custom route we have to create a <strong>di.xml<\/strong> file on the following path.<\/p>\n\n\n\n<p><strong>&lt;magento-root-dir.&gt;<\/strong>\/<strong>app\/code\/Webkul\/Hello\/etc\/frontend<\/strong>\/<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;type name=&quot;Magento\\Framework\\App\\RouterList&quot;&gt;\n    &lt;arguments&gt;\n        &lt;argument name=&quot;routerList&quot; xsi:type=&quot;array&quot;&gt;\n            &lt;item name=&quot;customRoute&quot; xsi:type=&quot;array&quot;&gt;\n                &lt;item name=&quot;class&quot; xsi:type=&quot;string&quot;&gt;Webkul\\Hello\\Controller\\Router&lt;\/item&gt;\n                &lt;item name=&quot;disable&quot; xsi:type=&quot;boolean&quot;&gt;false&lt;\/item&gt;\n                &lt;item name=&quot;sortOrder&quot; xsi:type=&quot;string&quot;&gt;40&lt;\/item&gt;\n            &lt;\/item&gt;\n        &lt;\/argument&gt;\n    &lt;\/arguments&gt;\n&lt;\/type&gt;<\/pre>\n\n\n\n<p>After creating the di.xml file, now let&#8217;s create the controller<\/p>\n\n\n\n<p>It will handle the routing route and will get the parameters passed by our router.<\/p>\n\n\n\n<p>We have to create a controller class<strong> Index.php<\/strong> on the following path:<\/p>\n\n\n\n<p><strong>&lt;magento-root-dir.&gt;<\/strong>\/<strong>app\/code\/Webkul\/Hello\/Controller\/Index<\/strong>\/<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\ndeclare(strict_types=1);\n\nnamespace Webkul\\Hello\\Controller\\Index;\n\nuse Magento\\Framework\\App\\Action\\HttpGetActionInterface;\nuse Magento\\Framework\\App\\RequestInterface;\nuse Magento\\Framework\\View\\Result\\Page;\nuse Magento\\Framework\\View\\Result\\PageFactory;\n\n\/**\n * Class Index\n *\/\nclass Index implements HttpGetActionInterface\n{\n    \/**\n     * @var PageFactory\n     *\/\n    private $pageFactory;\n\n    \/**\n      * @var RequestInterface\n      *\/\n    private $request;\n\n    \/**\n     * @param PageFactory $pageFactory\n     * @param RequestInterface $request\n     *\/\n    public function __construct(PageFactory $pageFactory, RequestInterface $request)\n    {\n        $this-&gt;pageFactory = $pageFactory;\n        $this-&gt;request = $request;\n    }\n\n    \/**\n     * @inheritdoc\n     *\/\n    public function execute()\n    {\n        \/\/ Get the params that were passed from our Router\n        $firstParam = $this-&gt;request-&gt;getParam(&#039;first_param&#039;, null);\n        $secondParam = $this-&gt;request-&gt;getParam(&#039;second_param&#039;, null);\n\n        return $this-&gt;pageFactory-&gt;create();\n    }\n}<\/pre>\n\n\n\n<p>In the end, let&#8217;s create the router class Router.php inside the <strong>&lt;magento-root-dir.&gt;<\/strong>\/<strong>app\/code\/Webkul\/Hello\/Controller<\/strong>\/ directory path.<\/p>\n\n\n\n<p>that will match the custom route name &#8216;<strong>learning<\/strong>&#8216; with the existing &#8216;<strong>routing<\/strong>&#8216; route.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\ndeclare(strict_types=1);\n\nnamespace Webkul\\Hello\\Controller;\n\nuse Magento\\Framework\\App\\Action\\Forward;\nuse Magento\\Framework\\App\\ActionFactory;\nuse Magento\\Framework\\App\\ActionInterface;\nuse Magento\\Framework\\App\\RequestInterface;\nuse Magento\\Framework\\App\\ResponseInterface;\nuse Magento\\Framework\\App\\RouterInterface;\n\n\/**\n * Class Router\n *\/\nclass Router implements RouterInterface\n{\n    \/**\n     * @var ActionFactory\n     *\/\n    private $actionFactory;\n\n    \/**\n     * @var ResponseInterface\n     *\/\n    private $response;\n\n    \/**\n     * Router constructor.\n     *\n     * @param ActionFactory $actionFactory\n     * @param ResponseInterface $response\n     *\/\n    public function __construct(\n        ActionFactory $actionFactory,\n        ResponseInterface $response\n    ) {\n        $this-&gt;actionFactory = $actionFactory;\n        $this-&gt;response = $response;\n    }\n\n    \/**\n     * @param RequestInterface $request\n     * @return ActionInterface|null\n     *\/\n    public function match(RequestInterface $request): ?ActionInterface\n    {\n        $identifier = trim($request-&gt;getPathInfo(), &#039;\/&#039;);\n\n        if (strpos($identifier, &#039;learning&#039;) !== false) {\n            $request-&gt;setModuleName(&#039;routing&#039;);\n            $request-&gt;setControllerName(&#039;index&#039;);\n            $request-&gt;setActionName(&#039;index&#039;);\n            $request-&gt;setParams(&#091;\n                &#039;first_param&#039; =&gt; &#039;first_value&#039;,\n                &#039;second_param&#039; =&gt; &#039;second_value&#039;\n            ]);\n\n            return $this-&gt;actionFactory-&gt;create(Forward::class, &#091;&#039;request&#039; =&gt; $request]);\n        }\n\n        return null;\n    }\n}<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"652\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/06\/Screenshot-from-2023-06-01-13-19-24-1200x652.png\" alt=\"custom router\" class=\"wp-image-384987\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/06\/Screenshot-from-2023-06-01-13-19-24-1200x652.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/06\/Screenshot-from-2023-06-01-13-19-24-300x163.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/06\/Screenshot-from-2023-06-01-13-19-24-250x136.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/06\/Screenshot-from-2023-06-01-13-19-24-768x418.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/06\/Screenshot-from-2023-06-01-13-19-24.png 1293w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>That\u2019s all in this article, hope it will help you to create a custom router in magento2. <\/p>\n\n\n\n<p>Try the above code and if you have any issues just comment below.<\/p>\n\n\n\n<p>You can get more magento2 (Adobe Commerce) articles<a href=\"https:\/\/webkul.com\/blog\/?s=magento2\" target=\"_blank\" rel=\"noreferrer noopener\"> here.<\/a><\/p>\n\n\n\n<p> Happy Coding \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog, We will learn how to create a custom router in Magento2. First of all, let&#8217;s discuss what is a router in Magento2. A router is a PHP class that is used for matching and processing the URL request in the module. In other words, Routing defines a name for a module that <a href=\"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":513,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9121,302],"tags":[12677,2070,590],"class_list":["post-384603","post","type-post","status-publish","format-standard","hentry","category-magento-2","category-magento2","tag-custom-router","tag-magento2","tag-webkul"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Custom Router - Router Magento2<\/title>\n<meta name=\"description\" content=\"Routing defines a name for a module that we use in the URL to find the module and execute the controller action in Magento2. the custom router in Magento2\" \/>\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\/how-to-create-custom-routes-adobe-commerce\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Custom Router - Router Magento2\" \/>\n<meta property=\"og:description\" content=\"Routing defines a name for a module that we use in the URL to find the module and execute the controller action in Magento2. the custom router in Magento2\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/\" \/>\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=\"2023-06-01T08:53:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-01T08:56:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/06\/Screenshot-from-2023-06-01-13-19-24-1200x652.png\" \/>\n<meta name=\"author\" content=\"Anjali Singh\" \/>\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=\"Anjali Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/\"},\"author\":{\"name\":\"Anjali Singh\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/1369cd65cc2813928f7d73f2737295bc\"},\"headline\":\"How to create custom routes &#8211; Adobe Commerce\",\"datePublished\":\"2023-06-01T08:53:58+00:00\",\"dateModified\":\"2023-06-01T08:56:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/\"},\"wordCount\":408,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/06\/Screenshot-from-2023-06-01-13-19-24-1200x652.png\",\"keywords\":[\"custom router\",\"Magento2\",\"webkul\"],\"articleSection\":[\"Magento 2\",\"Magento2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/\",\"url\":\"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/\",\"name\":\"Custom Router - Router Magento2\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/06\/Screenshot-from-2023-06-01-13-19-24-1200x652.png\",\"datePublished\":\"2023-06-01T08:53:58+00:00\",\"dateModified\":\"2023-06-01T08:56:03+00:00\",\"description\":\"Routing defines a name for a module that we use in the URL to find the module and execute the controller action in Magento2. the custom router in Magento2\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/06\/Screenshot-from-2023-06-01-13-19-24.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/06\/Screenshot-from-2023-06-01-13-19-24.png\",\"width\":1293,\"height\":703,\"caption\":\"Screenshot-from-2023-06-01-13-19-24\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to create custom routes &#8211; Adobe Commerce\"}]},{\"@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\/1369cd65cc2813928f7d73f2737295bc\",\"name\":\"Anjali Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3658f0c75ebe7329c40b8fdfbdb013fa1eea48f721303b5c0fd15e38426a9291?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\/3658f0c75ebe7329c40b8fdfbdb013fa1eea48f721303b5c0fd15e38426a9291?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Anjali Singh\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/anjalisingh-mg635\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Custom Router - Router Magento2","description":"Routing defines a name for a module that we use in the URL to find the module and execute the controller action in Magento2. the custom router in Magento2","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\/how-to-create-custom-routes-adobe-commerce\/","og_locale":"en_US","og_type":"article","og_title":"Custom Router - Router Magento2","og_description":"Routing defines a name for a module that we use in the URL to find the module and execute the controller action in Magento2. the custom router in Magento2","og_url":"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2023-06-01T08:53:58+00:00","article_modified_time":"2023-06-01T08:56:03+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/06\/Screenshot-from-2023-06-01-13-19-24-1200x652.png","type":"","width":"","height":""}],"author":"Anjali Singh","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Anjali Singh","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/"},"author":{"name":"Anjali Singh","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/1369cd65cc2813928f7d73f2737295bc"},"headline":"How to create custom routes &#8211; Adobe Commerce","datePublished":"2023-06-01T08:53:58+00:00","dateModified":"2023-06-01T08:56:03+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/"},"wordCount":408,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/06\/Screenshot-from-2023-06-01-13-19-24-1200x652.png","keywords":["custom router","Magento2","webkul"],"articleSection":["Magento 2","Magento2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/","url":"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/","name":"Custom Router - Router Magento2","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/06\/Screenshot-from-2023-06-01-13-19-24-1200x652.png","datePublished":"2023-06-01T08:53:58+00:00","dateModified":"2023-06-01T08:56:03+00:00","description":"Routing defines a name for a module that we use in the URL to find the module and execute the controller action in Magento2. the custom router in Magento2","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/06\/Screenshot-from-2023-06-01-13-19-24.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/06\/Screenshot-from-2023-06-01-13-19-24.png","width":1293,"height":703,"caption":"Screenshot-from-2023-06-01-13-19-24"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/how-to-create-custom-routes-adobe-commerce\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to create custom routes &#8211; Adobe Commerce"}]},{"@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\/1369cd65cc2813928f7d73f2737295bc","name":"Anjali Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3658f0c75ebe7329c40b8fdfbdb013fa1eea48f721303b5c0fd15e38426a9291?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\/3658f0c75ebe7329c40b8fdfbdb013fa1eea48f721303b5c0fd15e38426a9291?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Anjali Singh"},"url":"https:\/\/webkul.com\/blog\/author\/anjalisingh-mg635\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/384603","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\/513"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=384603"}],"version-history":[{"count":24,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/384603\/revisions"}],"predecessor-version":[{"id":385026,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/384603\/revisions\/385026"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=384603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=384603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=384603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}