I want to redirect Laravel version 5.2 default 404 page to my template page of 404, from where and what to change

Viewed 23521

I am using Laravel version 5.2 and don't know how to redirect Laravel default page to my template 404 page

4 Answers

Modify app/Exceptions/Handler.php and add some lines as below:-

public function render($request, Exception $e)
{
  if ($e instanceof \Symfony\Component\HttpKernel\Exception\NotFoundHttpException) 
  {
    return redirect('/');
  } 
 return parent::render($request, $e); }

Use your route name in place of / where you want to redirect.

Related