


If a request cannot be processed by any router, the default router is used.FrontController obtains active routers and checks whether a request can be processed.

Modules provide information on their routers through the routerList parameter of Magento\Framework\App\RouterList type in di.xml.Routing is processed in the following way: To remove the controller action, forward to noroute, for instance, in app/code/Company/SomeExtension/Controller/Account/Create.php: namespaceĬompany\SomeExtension\Controller\Account Ĭlass Create extends \Magento\Framework\App\Action\Action $this->_forward('other/controller/action') If you must reset a route and design, forward the request processing to another route: The system processes the custom controller before the original, while a route remains the same. The custom controller and action should share the same names with the original ones. To replace the controller action in a route with custom one, add the custom controller class before the original controller. To retrieve the configuration for route for an area by the specified router, use the Magento\App\Framework\Route\Config. %frontName% must be at least three characters in length and can consist of the following characters: A-Z, a-z, 0-9, _,. %routeId% must be at least three characters in length and can consist of the following characters: A-Z, a-z, 0-9, _. Typically, the configuration for a route is in the following format: RoutesĬonfigurations of the routes are stored in routes.xml in the scopes area. However, you must not customize the routers that are used in Magento core modules. You might need to customize the routers to change either the standard logic of processing the requests or the native Magento routers The Magento\Framework\App\RouterList model is injected into FrontController.

The routers information for the modules is described in the routerList parameter of Magento\Framework\App\RouterList type in your di.xml.Įach area has its own set of the routers. Use the routes.xml file to review or change the route rules. Then, according to a route rule, controller is assigned to URL. Router has an algorithm to find a matching controller, determined by request. To assign a URL to a corresponding controller and action, use the router class. Magento provides areas such as frontend for the storefront and adminhtml for the administration area.) (The area name is used internally to refer to the area in configuration files. indicates it is at the “front” of the URL. For the latest supported documentation, see. This archived documentation is not supported. Upload your component to the Magento Marketplace.Roadmap for developing and packaging components.
