{"id":13446,"date":"2017-06-08T15:34:52","date_gmt":"2017-06-08T12:34:52","guid":{"rendered":"https:\/\/belvg.com\/blog\/?p=13446"},"modified":"2025-02-11T13:12:57","modified_gmt":"2025-02-11T11:12:57","slug":"request-routing-in-magento-2","status":"publish","type":"post","link":"https:\/\/belvg.com\/blog\/request-routing-in-magento-2.html","title":{"rendered":"Request Routing in Magento 2"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">In the article, we&#8217;re going to compare routing in Magento 1 and Magento 2. <\/span><span style=\"font-weight: 400;\">Actually, there&#8217;s an <a href=\"https:\/\/belvg.com\/blog\/magento-certified-developer-exam-request-routing.html\">article containing routing description in Magento 1<\/a>, so in case you&#8217;d like to have a closer look at routing in Magento 1, read our blog.<!--more--><\/span><\/p>\n<p><span style=\"font-weight: 400;\">Route determination starts from searching for current route defined in the system. The process starts here:<\/span><\/p>\n<p><em><span style=\"font-weight: 400;\">\/vendor\/magento\/framework\/App\/FrontController.php<\/span><\/em><\/p>\n<pre class=\"lang:php decode:true\">public function dispatch(RequestInterface $request)\r\n    {\r\n        \\Magento\\Framework\\Profiler::start('routers_match');\r\n        $routingCycleCounter = 0;\r\n        $result = null;\r\n        while (!$request-&gt;isDispatched() &amp;&amp; $routingCycleCounter++ &lt; 100) {\r\n            \/** @var \\Magento\\Framework\\App\\RouterInterface $router *\/\r\n            foreach ($this-&gt;_routerList as $router) {\r\n                try {\r\n                    $actionInstance = $router-&gt;match($request);\r\n                    if ($actionInstance) {\r\n                        $request-&gt;setDispatched(true);\r\n                        $this-&gt;response-&gt;setNoCacheHeaders();\r\n                        if ($actionInstance instanceof \\Magento\\Framework\\App\\Action\\AbstractAction) {\r\n                            $result = $actionInstance-&gt;dispatch($request);\r\n                        } else {\r\n                            $result = $actionInstance-&gt;execute();\r\n                        }\r\n                        break;\r\n                    }\r\n                } catch (\\Magento\\Framework\\Exception\\NotFoundException $e) {\r\n                    $request-&gt;initForward();\r\n                    $request-&gt;setActionName('noroute');\r\n                    $request-&gt;setDispatched(false);\r\n                    break;\r\n                }\r\n            }\r\n        }\r\n        \\Magento\\Framework\\Profiler::stop('routers_match');\r\n        if ($routingCycleCounter &gt; 100) {\r\n            throw new \\LogicException('Front controller reached 100 router match iterations');\r\n        }\r\n        return $result;\r\n    }\r\n<\/pre>\n<p><span style=\"font-weight: 400;\">In the method<em> dispatch()<\/em> as well as in Magento 1 file <em>app\/code\/core\/Mage\/Core\/Controller\/Varien\/Front.php<\/em> there are some matches:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Checking is a request by dispatcher (<em>$request-&gt;isDispatched()<\/em>);<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Searching for matches (<em>$router-&gt;match($request)<\/em>).<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">In comparison with Magento 1, there are only two routings determined in Magento 2:<\/span><\/p>\n<ul>\n<li><em><span style=\"font-weight: 400;\">\/vendor\/magento\/framework\/App\/Router\/Base.php;<\/span><\/em><\/li>\n<li><em><span style=\"font-weight: 400;\">\/vendor\/magento\/framework\/App\/Router\/DefaultRouter.php.<\/span><\/em><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">The same as in Magento 1, after 100 iterations if a router is not found, there will be a message displayed. Here we can find attributes of Magento 1:<\/span><\/p>\n<pre class=\"lang:php decode:true \">if ($routingCycleCounter &gt; 100) {\r\n            throw new \\LogicException('Front controller reached 100 router match iterations');\r\n        }\r\n<\/pre>\n<p><span style=\"font-weight: 400;\">The main steps of routing process are the same as in Magento 1:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Determining module<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Determining controller<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Action for detection<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Data for current request detection<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Router initialization in Magento 2 differs from Magento 1:<\/span><\/p>\n<pre class=\"lang:php decode:true\">protected function _getRoutes($scope = null)\r\n    {\r\n        $scope = $scope ?: $this-&gt;_configScope-&gt;getCurrentScope();\r\n        if (isset($this-&gt;_routes[$scope])) {\r\n            return $this-&gt;_routes[$scope];\r\n        }\r\n        $cacheId = $scope . '::' . $this-&gt;_cacheId;\r\n        $cachedRoutes = unserialize($this-&gt;_cache-&gt;load($cacheId));\r\n        if (is_array($cachedRoutes)) {\r\n            $this-&gt;_routes[$scope] = $cachedRoutes;\r\n            return $cachedRoutes;\r\n        }\r\n \r\n        $routers = $this-&gt;_reader-&gt;read($scope);\r\n        $routes = $routers[$this-&gt;_areaList-&gt;getDefaultRouter($scope)]['routes'];\r\n        $this-&gt;_cache-&gt;save(serialize($routes), $cacheId);\r\n        $this-&gt;_routes[$scope] = $routes;\r\n        return $routes;\r\n    }\r\n \r\npublic function read($scope = null)\r\n{\r\n\t$scope = $scope ?: $this-&gt;_defaultScope;\r\n\t$fileList = $this-&gt;_fileResolver-&gt;get($this-&gt;_fileName, $scope);\r\n\tif (!count($fileList)) {\r\n\t\treturn [];\r\n\t}\r\n\t$output = $this-&gt;_readFiles($fileList);\r\n \r\n\treturn $output;\r\n}\r\n<\/pre>\n<p><span style=\"font-weight: 400;\">Initialization occurs when searching for an appropriate router:<\/span><\/p>\n<pre class=\"lang:php decode:true \">&#8230;\r\nwhile (!$request-&gt;isDispatched() &amp;&amp; $routingCycleCounter++ &lt; 100) {\r\n            \/** @var \\Magento\\Framework\\App\\RouterInterface $router *\/\r\n            foreach ($this-&gt;_routerList as $router) {\r\n                try {\r\n                    $actionInstance = $router-&gt;match($request);\r\n                    if ($actionInstance) { \r\n\t\t\t&#8230;\r\n<\/pre>\n<p><span style=\"font-weight: 400;\">Further routing process resembles Magento 1:<\/span><\/p>\n<pre class=\"lang:php decode:true \">protected function parseRequest(\\Magento\\Framework\\App\\RequestInterface $request)\r\n    {\r\n        $output = [];\r\n \r\n        $path = trim($request-&gt;getPathInfo(), '\/');\r\n \r\n        $params = explode('\/', $path ? $path : $this-&gt;pathConfig-&gt;getDefaultPath());\r\n        foreach ($this-&gt;_requiredParams as $paramName) {\r\n            $output[$paramName] = array_shift($params);\r\n        }\r\n \r\n        for ($i = 0, $l = sizeof($params); $i &lt; $l; $i += 2) {\r\n            $output['variables'][$params[$i]] = isset($params[$i + 1]) ? urldecode($params[$i + 1]) : '';\r\n        }\r\n        return $output;\r\n    }\r\n<\/pre>\n<p><span style=\"font-weight: 400;\">The first three elements are considered as main. They define a module, controller, and action for a current request. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">Then module is determined from its moduleFrontName:<\/span><\/p>\n<pre class=\"lang:php decode:true \">\/**\r\n         * Searching router args by module name from route using it as key\r\n         *\/\r\n        $modules = $this&#8594;_routeConfig&#8594;getModulesByFrontName($moduleFrontName);\r\n<\/pre>\n<p><span style=\"font-weight: 400;\">Then a controller and action for a current request are determined:<\/span><\/p>\n<pre class=\"lang:php decode:true \"> \/**\r\n         * Going through modules to find appropriate controller\r\n         *\/\r\n        $currentModuleName = null;\r\n        $actionPath = null;\r\n        $action = null;\r\n        $actionInstance = null;\r\n \r\n        $actionPath = $this-&gt;matchActionPath($request, $params['actionPath']);\r\n        $action = $request-&gt;getActionName() ?: ($params['actionName'] ?: $this-&gt;_defaultPath-&gt;getPart('action'));\r\n        $this-&gt;_checkShouldBeSecure($request, '\/' . $moduleFrontName . '\/' . $actionPath . '\/' . $action);\r\n \r\n        foreach ($modules as $moduleName) {\r\n            $currentModuleName = $moduleName;\r\n \r\n            $actionClassName = $this-&gt;actionList-&gt;get($moduleName, $this-&gt;pathPrefix, $actionPath, $action);\r\n            if (!$actionClassName || !is_subclass_of($actionClassName, $this-&gt;actionInterface)) {\r\n                continue;\r\n            }\r\n \r\n            $actionInstance = $this-&gt;actionFactory-&gt;create($actionClassName);\r\n            break;\r\n        }\r\n \r\n        if (null == $actionInstance) {\r\n            $actionInstance = $this-&gt;getNotFoundAction($currentModuleName);\r\n            if ($actionInstance === null) {\r\n                return null;\r\n            }\r\n            $action = 'noroute';\r\n        }\r\n<\/pre>\n<p><span style=\"font-weight: 400;\">Besides, it is checked whether the connection is safe if there is a controller file, as well as previous realization, is stored:<\/span><\/p>\n<pre class=\"lang:php decode:true \">$this-&gt;_checkShouldBeSecure($request, '\/' . $moduleFrontName . '\/' . $actionPath . '\/' . $action);\r\n<\/pre>\n<p><span style=\"font-weight: 400;\">It implies that route is processed. Module, controller, and action are determined. Moreover, an action for a current request is being processed. <\/span><\/p>\n<pre class=\"lang:php decode:true \">\/\/ set values only after all the checks are done\r\n        $request-&gt;setModuleName($moduleFrontName);\r\n        $request-&gt;setControllerName($actionPath);\r\n        $request-&gt;setActionName($action);\r\n        $request-&gt;setControllerModule($currentModuleName);\r\n        $request-&gt;setRouteName($this-&gt;_routeConfig-&gt;getRouteByFrontName($moduleFrontName));\r\n        if (isset($params['variables'])) {\r\n            $request-&gt;setParams($params['variables']);\r\n        }\r\n        return $actionInstance;\r\n<\/pre>\n<p><span style=\"font-weight: 400;\">Control element returns for performing action:<\/span><\/p>\n<pre class=\"lang:php decode:true \">&#8230;\r\n\t\tif ($actionInstance) {\r\n                        $request-&gt;setDispatched(true);\r\n                        $this-&gt;response-&gt;setNoCacheHeaders();\r\n                        if ($actionInstance instanceof \\Magento\\Framework\\App\\Action\\AbstractAction) {\r\n                            $result = $actionInstance-&gt;dispatch($request);\r\n                        } else {\r\n                            $result = $actionInstance-&gt;execute();\r\n                        }\r\n                        break;\r\n                    }\r\n\t\t...\r\n<\/pre>\n<p><span style=\"font-weight: 400;\">Where for a current request output is determined.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"In the article, we&#8217;re going to compare routing in Magento 1 and Magento 2. Actually, &#8230;","protected":false},"author":2,"featured_media":13448,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"image","meta":{"_acf_changed":false,"footnotes":""},"categories":[35,14,389,471],"tags":[],"class_list":["post-13446","post","type-post","status-publish","format-image","has-post-thumbnail","hentry","category-certification","category-magento","category-magento2-development","category-magento-developer","post_format-image"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"In the article, we\u2019re going to compare routing in Magento 1 and Magento 2. Actually, there\u2019s an article containing routing description in Magento 1, so in case you\u2019d like to have a closer look at routing in Magento 1, read our blog.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Pavel Novitsky\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/belvg.com\/blog\/request-routing-in-magento-2.html\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-in-magento-2.html#article\",\"name\":\"Request Routing in Magento 2 | BelVG Blog\",\"headline\":\"Request Routing in Magento 2\",\"author\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/luge#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/06\\\/request-routing-in-magento-2.jpg\",\"width\":700,\"height\":290,\"caption\":\"request routing in magento 2\"},\"datePublished\":\"2017-06-08T15:34:52+02:00\",\"dateModified\":\"2025-02-11T13:12:57+02:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-in-magento-2.html#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-in-magento-2.html#webpage\"},\"articleSection\":\"Certification, Magento, Magento 2 Development, Magento Developer, Image\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-in-magento-2.html#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento#listItem\",\"name\":\"Magento\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento#listItem\",\"position\":2,\"name\":\"Magento\",\"item\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-in-magento-2.html#listItem\",\"name\":\"Request Routing in Magento 2\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-in-magento-2.html#listItem\",\"position\":3,\"name\":\"Request Routing in Magento 2\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/magento#listItem\",\"name\":\"Magento\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\",\"name\":\"BelVG Blog\",\"description\":\"Magento and Prestashop articles\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/luge#author\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/luge\",\"name\":\"Pavel Novitsky\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-in-magento-2.html#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2c4388e3468896377123f434a9a2a2d64f479816da1570f85619b074102127b7?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Pavel Novitsky\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-in-magento-2.html#webpage\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-in-magento-2.html\",\"name\":\"Request Routing in Magento 2 | BelVG Blog\",\"description\":\"In the article, we\\u2019re going to compare routing in Magento 1 and Magento 2. Actually, there\\u2019s an article containing routing description in Magento 1, so in case you\\u2019d like to have a closer look at routing in Magento 1, read our blog.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-in-magento-2.html#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/luge#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/luge#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/06\\\/request-routing-in-magento-2.jpg\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-in-magento-2.html\\\/#mainImage\",\"width\":700,\"height\":290,\"caption\":\"request routing in magento 2\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-in-magento-2.html#mainImage\"},\"datePublished\":\"2017-06-08T15:34:52+02:00\",\"dateModified\":\"2025-02-11T13:12:57+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\",\"name\":\"BelVG Blog\",\"description\":\"Magento and Prestashop articles\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Request Routing in Magento 2 | BelVG Blog","description":"In the article, we\u2019re going to compare routing in Magento 1 and Magento 2. Actually, there\u2019s an article containing routing description in Magento 1, so in case you\u2019d like to have a closer look at routing in Magento 1, read our blog.","canonical_url":"https:\/\/belvg.com\/blog\/request-routing-in-magento-2.html","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/belvg.com\/blog\/request-routing-in-magento-2.html#article","name":"Request Routing in Magento 2 | BelVG Blog","headline":"Request Routing in Magento 2","author":{"@id":"https:\/\/belvg.com\/blog\/author\/luge#author"},"publisher":{"@id":"https:\/\/belvg.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2017\/06\/request-routing-in-magento-2.jpg","width":700,"height":290,"caption":"request routing in magento 2"},"datePublished":"2017-06-08T15:34:52+02:00","dateModified":"2025-02-11T13:12:57+02:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/belvg.com\/blog\/request-routing-in-magento-2.html#webpage"},"isPartOf":{"@id":"https:\/\/belvg.com\/blog\/request-routing-in-magento-2.html#webpage"},"articleSection":"Certification, Magento, Magento 2 Development, Magento Developer, Image"},{"@type":"BreadcrumbList","@id":"https:\/\/belvg.com\/blog\/request-routing-in-magento-2.html#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/#listItem","position":1,"name":"Home","item":"https:\/\/belvg.com\/blog\/","nextItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/magento#listItem","name":"Magento"}},{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/magento#listItem","position":2,"name":"Magento","item":"https:\/\/belvg.com\/blog\/category\/magento","nextItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/request-routing-in-magento-2.html#listItem","name":"Request Routing in Magento 2"},"previousItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/request-routing-in-magento-2.html#listItem","position":3,"name":"Request Routing in Magento 2","previousItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/magento#listItem","name":"Magento"}}]},{"@type":"Organization","@id":"https:\/\/belvg.com\/blog\/#organization","name":"BelVG Blog","description":"Magento and Prestashop articles","url":"https:\/\/belvg.com\/blog\/"},{"@type":"Person","@id":"https:\/\/belvg.com\/blog\/author\/luge#author","url":"https:\/\/belvg.com\/blog\/author\/luge","name":"Pavel Novitsky","image":{"@type":"ImageObject","@id":"https:\/\/belvg.com\/blog\/request-routing-in-magento-2.html#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/2c4388e3468896377123f434a9a2a2d64f479816da1570f85619b074102127b7?s=96&d=mm&r=g","width":96,"height":96,"caption":"Pavel Novitsky"}},{"@type":"WebPage","@id":"https:\/\/belvg.com\/blog\/request-routing-in-magento-2.html#webpage","url":"https:\/\/belvg.com\/blog\/request-routing-in-magento-2.html","name":"Request Routing in Magento 2 | BelVG Blog","description":"In the article, we\u2019re going to compare routing in Magento 1 and Magento 2. Actually, there\u2019s an article containing routing description in Magento 1, so in case you\u2019d like to have a closer look at routing in Magento 1, read our blog.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/belvg.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/belvg.com\/blog\/request-routing-in-magento-2.html#breadcrumblist"},"author":{"@id":"https:\/\/belvg.com\/blog\/author\/luge#author"},"creator":{"@id":"https:\/\/belvg.com\/blog\/author\/luge#author"},"image":{"@type":"ImageObject","url":"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2017\/06\/request-routing-in-magento-2.jpg","@id":"https:\/\/belvg.com\/blog\/request-routing-in-magento-2.html\/#mainImage","width":700,"height":290,"caption":"request routing in magento 2"},"primaryImageOfPage":{"@id":"https:\/\/belvg.com\/blog\/request-routing-in-magento-2.html#mainImage"},"datePublished":"2017-06-08T15:34:52+02:00","dateModified":"2025-02-11T13:12:57+02:00"},{"@type":"WebSite","@id":"https:\/\/belvg.com\/blog\/#website","url":"https:\/\/belvg.com\/blog\/","name":"BelVG Blog","description":"Magento and Prestashop articles","inLanguage":"en-US","publisher":{"@id":"https:\/\/belvg.com\/blog\/#organization"}}]}},"aioseo_meta_data":{"post_id":"13446","title":"Request Routing in Magento 2 | #site_title","description":"In the article, we\u2019re going to compare routing in Magento 1 and Magento 2. Actually, there\u2019s an article containing routing description in Magento 1, so in case you\u2019d like to have a closer look at routing in Magento 1, read our blog.","keywords":null,"keyphrases":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_image_url":null,"twitter_title":null,"twitter_description":null,"schema_type":"default","schema_type_options":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null,"created":"2026-11-03 18:37:18","updated":"2026-11-03 18:37:18"},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/belvg.com\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/belvg.com\/blog\/category\/magento\" title=\"Magento\">Magento<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tRequest Routing in Magento 2\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/belvg.com\/blog\/"},{"label":"Magento","link":"https:\/\/belvg.com\/blog\/category\/magento"},{"label":"Request Routing in Magento 2","link":"https:\/\/belvg.com\/blog\/request-routing-in-magento-2.html"}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/13446","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/comments?post=13446"}],"version-history":[{"count":0,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/13446\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/media\/13448"}],"wp:attachment":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/media?parent=13446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/categories?post=13446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/tags?post=13446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}