MISS route/default route
Global MISS routing
##If the route match fails, it is a good idea to redirect it to a specified route
If you want to execute a set route after not matching all routing rules, you can register A separate MISS route:Route::miss('public/miss');Or use closure definition
Route::miss(function() { return '404 Not Found!'; });Once the MISS route is set, it is equivalent to turning on the forced routing modeWhen all defined routes If none of the rules match, it will be routed to the routing address defined by the miss method. You can limit the request types of MISS routing
// 只有GET请求下MISS路由有效 Route::miss('public/miss', 'get');
Domain name MISS routing
Route::domain('blog', function () { // 动态注册域名的路由规则 Route::rule('new/:id', 'news/read'); Route::rule(':user', 'user/info'); Route::miss('blog/miss'); });
Group MISS routing
Route::group('blog', function () { Route::rule(':id', 'blog/read'); Route::rule(':name', 'blog/read'); Route::miss('blog/miss'); })->ext('html') ->pattern(['id' => '\d+', 'name' => '\w+']);