Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel default route to 404 page

I'm using Laravel 4 framework and I've defined a whole bunch of routes, now I wonder for all the undefined urls, how to route them to 404 page?

like image 571
dulan Avatar asked Nov 06 '14 01:11

dulan


People also ask

How do I redirect default 404 in Laravel?

For example, this may be a "page not found" error (404), an "unauthorized error" (401) or even a developer generated 500 error. In order to generate such a response from anywhere in your application, use the following: abort(404);

How can I get route name in Laravel?

You may use the current, currentRouteName, and currentRouteAction methods on the Route facade to access information about the route handling the incoming request: $route = Route::current(); $name = Route::currentRouteName(); $action = Route::currentRouteAction();

What is prefix in Laravel route?

Path prefixes are used when we want to provide a common URL structure. We can specify the prefix for all the routes defined within the group by using the prefix array option in the route group.


1 Answers

In Laravel 5.2. Do nothing just create a file name 404.blade.php in the errors folder , it will detect 404 exception automatically.

like image 126
Chutipong Roobklom Avatar answered Sep 27 '22 16:09

Chutipong Roobklom