-
robots (10)
-
urlrewrite (20)
-
standard (30) - module/controller/action
- get modules by front name registered in routes.xml
- find action class
- if action not found in all modules, searches "noroute" action in last module
-
cms (60)
-
default (100) - noRouteActionList - 'default' noroute handler
Adminhtml routers:
- admin (10) - extends base router - module/controller/action, controller path prefix "adminhtml"
- default (100) - noRouteActionList - 'backend' noroute handler
Default router (frontend and backend):
-
noRouteHandlerList. process
-
backend (10) Default admin 404 page "adminhtml/noroute/index" when requested path starts with admin route.
-
default (100) Default frontend 404 page "cms/noroute/index" - admin config option
web/default/no_route
.
-
-
always returns forward action - just mark request not dispatched - this will continue match loop
Create new router when URL structure doesn't fit into module/controller/action template, e.g. fixed robots.txt or dynamic arbitraty rewrites from DB.
If you want to replace controller action, you can register custom module in controller lookup sequence - reference route by ID and add own module "before" original module.
-
If front controller catches \Magento\Framework\Exception\NotFoundException, it changes action name "noroute" and continues loop. E.g. catalog/product/view/id/1 throws NotFoundException. catalog/product/noroute is checked.
-
If standard router recognizes front name but can't find controller, it tries to find "noroute" action from last checked module. E.g. catalog/brand/info controller doesn't exist, so catalog/brand/noroute will be checked.
-
If all routers didn't match, default controller provides two opportunities:
- set default 404 route in admin config
web/default/no_route
(see: \Magento\Framework\App\Router\NoRouteHandler::process) - register custom handler in noRouteHandlerList:
- backend (sortOrder: 10) Magento\Backend\App\Router\NoRouteHandler ->
adminhtml/noroute/index
- default (sortOrder: 100) Magento\Framework\App\Router\NoRouteHandler
- backend (sortOrder: 10) Magento\Backend\App\Router\NoRouteHandler ->