Support the ongoing development of Laravel.io →
posted 7 years ago
Requests
Last updated 4 months ago.
0

More detailed on StackOverflow.

Open up app\Http\Kernel.php and change the content in the handle method to this:

try
{
	return parent::handle($request);
}
catch(\Symfony\Component\HttpKernel\Exception\NotFoundHttpException $e)
{
	return $this->app->make('Illuminate\Routing\ResponseFactory')->view('error.404', [], 404);
}
catch (Exception $e)
{
	throw $e;
}

This will catch 404 Not Found exceptions and display the view file error/404.blade.php.

I believe this is the way in Laravel 5 to catch exceptions.

Last updated 4 months ago.
0

@Marwelln thanks

yes that's a better way to handle this then what i did, what i did basically redirect any page errors not just 404 to index. this way at-least it will let us control which page to deploy for each types of errors.

i am gonna use this for now, i am assuming even this will change in few days hehe.

Last updated 4 months ago.
0

This doesn't work for me. Just a blank page.

0

Sign in to participate in this thread!

Cloudways

Your banner here too?

muhamin muhamin Joined 9 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.