{"id":15804,"date":"2018-05-15T15:36:44","date_gmt":"2018-05-15T13:36:44","guid":{"rendered":"https:\/\/belvg.com\/blog\/?p=15804"},"modified":"2019-03-15T12:22:53","modified_gmt":"2019-03-15T10:22:53","slug":"request-routing-flow-in-magento-2","status":"publish","type":"post","link":"https:\/\/belvg.com\/blog\/request-routing-flow-in-magento-2.html","title":{"rendered":"Request Routing Flow in Magento 2"},"content":{"rendered":"<p><span style=\"color: #000000\">Today we are going to talk about request routing and take a look at its customization process. Additionally, we will show you when it is necessary to create new routers and to customize the existing ones. Let&#8217;s get these things under the way.<\/span><\/p>\n<p><!--more--><\/p>\n<h2><strong><span style=\"color: #000000\">What is request routing flow in Magento 2?<\/span><\/strong><\/h2>\n<p><span style=\"color: #000000\">Routing in Magento is a process, that matches a request received in Magento, and the call of the corresponding control module. First of all, an application is created in the<strong> index.php<\/strong> file. Here starts the process of determining which of the routers will be called. Below you can see the parts of the code that are called.<\/span><\/p>\n<pre class=\"lang:php decode:true\">$app = $bootstrap-&gt;createApplication('Magento\\Framework\\App\\Http');\r\n$bootstrap-&gt;run($app);\r\n&#1044;&#1072;&#1083;&#1077;&#1077; &#1091; &#1089;&#1086;&#1079;&#1076;&#1072;&#1085;&#1085;&#1086;&#1075;&#1086; application &#1074;&#1099;&#1079;&#1099;&#1074;&#1072;&#1077;&#1090;&#1089;&#1103; &#1084;&#1077;&#1090;&#1086;&#1076; launch()\r\n\/*** Magento\\Framework\\App\\Bootstrap ***\/\r\npublic function run(AppInterface $application)\r\n{\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;\/* &#8230;. *\/\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$response = $application-&gt;launch();\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$response-&gt;sendResponse();\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;\/* &#8230;. *\/\r\n}\r\nThe &#8220;dispatch&#8221; method is also called here. It returns the result of the request.\r\n\/*** Magento\\Framework\\App\\Http ***\/\r\npublic function launch()\r\n{\r\n&#160;\/*** &#8230; ***\/\r\n&#160;&#160;\/** @var \\Magento\\Framework\\App\\FrontControllerInterface $frontController *\/\r\n&#160;&#160;$frontController = $this-&gt;_objectManager-&gt;get('Magento\\Framework\\App\\FrontControllerInterface');\r\n&#160;&#160;$result = $frontController-&gt;dispatch($this-&gt;_request);\r\n\/*** &#8230; ***\/\r\n&#160;&#160;return $this-&gt;_response;\r\n}<\/pre>\n<p><span style=\"color: #000000\">If you look at what the &#8220;dispatch&#8221; method contains, it becomes clear how the request is processed and the router is selected. Let us take a look at this code.<\/span><\/p>\n<p><span style=\"color: #000000\">Here each of the routers ($this&#160;<span style=\"font-weight: 400\">&#10132;&#160;<\/span>_routerList) is checked for compliance with the query. If found, the <strong>\\&#8221;Magento\\Framework\\App\\Action&#8221;<\/strong> object will be returned.<\/span><\/p>\n<p><span style=\"color: #000000\">If none of the routers finds a matching query, the standard&#160;<em>noroute<\/em> action class is called.<\/span><\/p>\n<pre class=\"lang:php decode:true\">l\r\n\/**\r\n* Class FrontController\r\n* @package Magento\\Framework\\App\r\n*\/\r\npublic function dispatch(RequestInterface $request)\r\n&#160;&#160;{\r\n\/******* .... *********\/\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;\/** @var \\Magento\\Framework\\App\\RouterInterface $router *\/\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;foreach ($this-&gt;_routerList as $router) {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;try {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$actionInstance = $router-&gt;match($request);\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if ($actionInstance) {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$request-&gt;setDispatched(true);\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$this-&gt;response-&gt;setNoCacheHeaders();\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if ($actionInstance instanceof \\Magento\\Framework\\App\\Action\\AbstractAction) {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$result = $actionInstance-&gt;dispatch($request);\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} else {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$result = $actionInstance-&gt;execute();\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;break;\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;\/****** &#8230; ******\/\r\n&#160;&#160;&#160;&#160;&#160;&#160;return $result;\r\n&#160;&#160;}\r\n}<\/pre>\n<p><span style=\"color: #000000\">It is easy to notice that the list of routers ($this <span style=\"font-weight: 400\">&#10132;<\/span> _routerList) is processed in the cycle. By default this list consists of standard routers implementing RouterInterface, which are called in the following sequence:<\/span><\/p>\n<ol>\n<li><span style=\"color: #000000\">Base Router<\/span><\/li>\n<li><span style=\"color: #000000\">CMS Router<\/span><\/li>\n<li><span style=\"color: #000000\">UrlRewrite Router<\/span><\/li>\n<li><span style=\"color: #000000\">Default Router<\/span><\/li>\n<\/ol>\n<h2><span style=\"color: #000000\"><b>Customize request routing<\/b><\/span><\/h2>\n<p><span style=\"color: #000000\">Magento allows you to add your router to this list. Now let&#8217;s consider an example of creating a custom router.<\/span><\/p>\n<p><span style=\"color: #000000\">The registration of a new router takes place in <strong>di.xml<\/strong>. Here you can define the class that is responsible for processing the request (item name = &#8220;class&#8221;), the priority of calling the router (item name = &#8220;sortOrder&#8221;)<\/span><\/p>\n<pre class=\"lang:xhtml decode:true\">&lt;?xml version=\"1.0\"?&gt;\r\n&lt;config xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:ObjectManager\/etc\/config.xsd\"&gt;\r\n&#160;&#160;&lt;type name=\"Magento\\Framework\\App\\RouterList\"&gt;\r\n&#160;&#160;&#160;&#160;&#160;&#160;&lt;arguments&gt;\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;argument name=\"routerList\" xsi:type=\"array\"&gt;\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;item name=\"newreqrouter\" xsi:type=\"array\"&gt;\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;item name=\"class\" xsi:type=\"string\"&gt;BelVG\\NewRequestRouter\\Controller\\Router&lt;\/item&gt;\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;item name=\"disable\" xsi:type=\"boolean\"&gt;false&lt;\/item&gt;\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;item name=\"sortOrder\" xsi:type=\"string\"&gt;30&lt;\/item&gt;\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;\/item&gt;\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&lt;\/argument&gt;\r\n&#160;&#160;&#160;&#160;&#160;&#160;&lt;\/arguments&gt;\r\n&#160;&#160;&lt;\/type&gt;\r\n&lt;\/config&gt;<\/pre>\n<p><span style=\"font-weight: 400;color: #000000\">The request will be processed directly in the Router class.<\/span><\/p>\n<pre class=\"lang:php decode:true\">\/* BelVG\\NewRequestRouter\\Controller\\Router*\/\r\nnamespace BelVG\\NewRequestRouter\\Controller;\r\n\/**\r\n* Class Router\r\n* @package BelVG\\NewRequestRouter\\Controller\r\n*\/\r\nclass Router implements \\Magento\\Framework\\App\\RouterInterface\r\n{\r\n&#160;\/**\r\n&#160;&#160;* @var \\Magento\\Framework\\App\\ActionFactory\r\n&#160;&#160;*\/\r\n&#160;protected $actionFactory;\r\n&#160;\/**\r\n&#160;&#160;* Response\r\n&#160;&#160;*\r\n&#160;&#160;* @var \\Magento\\Framework\\App\\ResponseInterface\r\n&#160;&#160;*\/\r\n&#160;protected $_response;\r\n&#160;\/**\r\n&#160;&#160;* @param \\Magento\\Framework\\App\\ActionFactory $actionFactory\r\n&#160;&#160;* @param \\Magento\\Framework\\App\\ResponseInterface $response\r\n&#160;&#160;*\/\r\n&#160;public function __construct(\r\n&#160;&#160;&#160;&#160;\\Magento\\Framework\\App\\ActionFactory $actionFactory,\r\n&#160;&#160;&#160;&#160;\\Magento\\Framework\\App\\ResponseInterface $response\r\n&#160;) {\r\n&#160;&#160;&#160;&#160;$this-&gt;actionFactory = $actionFactory;\r\n&#160;&#160;&#160;&#160;$this-&gt;_response = $response;\r\n&#160;}\r\n&#160;\/**\r\n&#160;&#160;* Validate and Match\r\n&#160;&#160;*\r\n&#160;&#160;* @param \\Magento\\Framework\\App\\RequestInterface $request\r\n&#160;&#160;* @return bool\r\n&#160;&#160;*\/\r\n&#160;public function match(\\Magento\\Framework\\App\\RequestInterface $request)\r\n&#160;{\r\n&#160;&#160;&#160;&#160;$identifier = trim($request-&gt;getPathInfo(), '\/');\r\n&#160;&#160;&#160;&#160;if(strpos($identifier, 'anytestrequest') !== false) {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;$request-&gt;setModuleName('newrequest')-&gt;setControllerName('test')\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;-&gt;setActionName('index');\r\n&#160;&#160;&#160;&#160;} else {\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;return;\r\n&#160;&#160;&#160;&#160;}\r\n&#160;&#160;&#160;&#160;return $this-&gt;actionFactory-&gt;create(\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;'Magento\\Framework\\App\\Action\\Forward',\r\n&#160;&#160;&#160;&#160;&#160;&#160;&#160;['request' =&gt; $request]\r\n&#160;&#160;&#160;&#160;);\r\n&#160;}\r\n}<\/pre>\n<p><span style=\"font-weight: 400;color: #000000\">You can check out the full version of the example of adding a new router <a style=\"color: #000000\" href=\"https:\/\/github.com\/bassurman\/newrequestrouter\" target=\"_blank\">here<\/a>.<\/span><\/p>\n<h2><span style=\"color: #000000\"><b>When it is necessary to create new routers and to customize the existing ones<\/b><\/span><\/h2>\n<p><span style=\"color: #000000\">Sometimes you may need to create your own router or customize an existing one. One good example is the &#8220;blog&#8221; module<\/span>,<span style=\"color: #000000\"> when you need to redirect seo<\/span><span style=\"color: #000000\">-friendly URLs to the corresponding posts. For this purpose, the module creates its own Router, which distributes the queries.<\/span><\/p>\n<p><span style=\"color: #000000\">Also, when migrating from any other platform to Magento, you may need to retain the connection between the old URLs and the new addresses. To do this, you can also use an additional router, which will contain the logic of finding a matching URL (old_webshop_url &#8211; magento_webshop).<\/span><\/p>\n<p><span style=\"color: #000000\">Customization of an existing router is required, when there is no way to bypass the processing of a standard router request. For example, the router is run in the queue earlier than the custom one and doesn&#8217;t find the path required for customization.<\/span><\/p>\n<p><span style=\"color: #000000\">Check out a <a href=\"https:\/\/belvg.com\/blog\/request-routing-in-magento-2.html\">related article<\/a>&#160;to find out more about request routing in Magento 2.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"Describing request routing and flow in Magento 2","protected":false},"author":42,"featured_media":15827,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"image","meta":{"_acf_changed":false,"footnotes":""},"categories":[14,471],"tags":[],"class_list":["post-15804","post","type-post","status-publish","format-image","has-post-thumbnail","hentry","category-magento","category-magento-developer","post_format-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=\"Describing request routing and flow in Magento 2. Demonstrating the ability to customize request routing. Creating new request routes.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Aliaksei Hryharenka\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/belvg.com\/blog\/request-routing-flow-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-flow-in-magento-2.html#article\",\"name\":\"How to customize request routing in Magento 2 | BelVG Blog\",\"headline\":\"Request Routing Flow in Magento 2\",\"author\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/aleksei-grigorenko#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/05\\\/equest_Routing_Flow_in_Magento_2-2.jpg\",\"width\":770,\"height\":433},\"datePublished\":\"2018-05-15T15:36:44+02:00\",\"dateModified\":\"2019-03-15T12:22:53+02:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-flow-in-magento-2.html#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-flow-in-magento-2.html#webpage\"},\"articleSection\":\"Magento, Magento Developer, Image\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-flow-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-flow-in-magento-2.html#listItem\",\"name\":\"Request Routing Flow in Magento 2\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-flow-in-magento-2.html#listItem\",\"position\":3,\"name\":\"Request Routing Flow 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\\\/aleksei-grigorenko#author\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/aleksei-grigorenko\",\"name\":\"Aliaksei Hryharenka\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-flow-in-magento-2.html#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bc7dc67af8fb059c80185d983bee2fdba6e6500979e4cb118ee4ba0de94c7837?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Aliaksei Hryharenka\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-flow-in-magento-2.html#webpage\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-flow-in-magento-2.html\",\"name\":\"How to customize request routing in Magento 2 | BelVG Blog\",\"description\":\"Describing request routing and flow in Magento 2. Demonstrating the ability to customize request routing. Creating new request routes.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-flow-in-magento-2.html#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/aleksei-grigorenko#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/aleksei-grigorenko#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/05\\\/equest_Routing_Flow_in_Magento_2-2.jpg\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-flow-in-magento-2.html\\\/#mainImage\",\"width\":770,\"height\":433},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/request-routing-flow-in-magento-2.html#mainImage\"},\"datePublished\":\"2018-05-15T15:36:44+02:00\",\"dateModified\":\"2019-03-15T12:22:53+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":"How to customize request routing in Magento 2 | BelVG Blog","description":"Describing request routing and flow in Magento 2. Demonstrating the ability to customize request routing. Creating new request routes.","canonical_url":"https:\/\/belvg.com\/blog\/request-routing-flow-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-flow-in-magento-2.html#article","name":"How to customize request routing in Magento 2 | BelVG Blog","headline":"Request Routing Flow in Magento 2","author":{"@id":"https:\/\/belvg.com\/blog\/author\/aleksei-grigorenko#author"},"publisher":{"@id":"https:\/\/belvg.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2018\/05\/equest_Routing_Flow_in_Magento_2-2.jpg","width":770,"height":433},"datePublished":"2018-05-15T15:36:44+02:00","dateModified":"2019-03-15T12:22:53+02:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/belvg.com\/blog\/request-routing-flow-in-magento-2.html#webpage"},"isPartOf":{"@id":"https:\/\/belvg.com\/blog\/request-routing-flow-in-magento-2.html#webpage"},"articleSection":"Magento, Magento Developer, Image"},{"@type":"BreadcrumbList","@id":"https:\/\/belvg.com\/blog\/request-routing-flow-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-flow-in-magento-2.html#listItem","name":"Request Routing Flow in Magento 2"},"previousItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/request-routing-flow-in-magento-2.html#listItem","position":3,"name":"Request Routing Flow 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\/aleksei-grigorenko#author","url":"https:\/\/belvg.com\/blog\/author\/aleksei-grigorenko","name":"Aliaksei Hryharenka","image":{"@type":"ImageObject","@id":"https:\/\/belvg.com\/blog\/request-routing-flow-in-magento-2.html#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/bc7dc67af8fb059c80185d983bee2fdba6e6500979e4cb118ee4ba0de94c7837?s=96&d=mm&r=g","width":96,"height":96,"caption":"Aliaksei Hryharenka"}},{"@type":"WebPage","@id":"https:\/\/belvg.com\/blog\/request-routing-flow-in-magento-2.html#webpage","url":"https:\/\/belvg.com\/blog\/request-routing-flow-in-magento-2.html","name":"How to customize request routing in Magento 2 | BelVG Blog","description":"Describing request routing and flow in Magento 2. Demonstrating the ability to customize request routing. Creating new request routes.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/belvg.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/belvg.com\/blog\/request-routing-flow-in-magento-2.html#breadcrumblist"},"author":{"@id":"https:\/\/belvg.com\/blog\/author\/aleksei-grigorenko#author"},"creator":{"@id":"https:\/\/belvg.com\/blog\/author\/aleksei-grigorenko#author"},"image":{"@type":"ImageObject","url":"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2018\/05\/equest_Routing_Flow_in_Magento_2-2.jpg","@id":"https:\/\/belvg.com\/blog\/request-routing-flow-in-magento-2.html\/#mainImage","width":770,"height":433},"primaryImageOfPage":{"@id":"https:\/\/belvg.com\/blog\/request-routing-flow-in-magento-2.html#mainImage"},"datePublished":"2018-05-15T15:36:44+02:00","dateModified":"2019-03-15T12:22:53+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":"15804","title":"How to customize request routing in Magento 2 | #site_title","description":"Describing request routing and flow in Magento 2. Demonstrating the ability to customize request routing.  Creating new request routes.","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:09","updated":"2026-11-03 18:37:09"},"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 Flow 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 Flow in Magento 2","link":"https:\/\/belvg.com\/blog\/request-routing-flow-in-magento-2.html"}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/15804","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\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/comments?post=15804"}],"version-history":[{"count":2,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/15804\/revisions"}],"predecessor-version":[{"id":20077,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/15804\/revisions\/20077"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/media\/15827"}],"wp:attachment":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/media?parent=15804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/categories?post=15804"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/tags?post=15804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}