Level 7
in your App\Exceptions\Handler you can add this in render method
if ($exception instanceof NotFoundHttpException) {
return redirect('/');
}
so the method will looks like
public function render($request, Exception $exception)
{
if ($exception instanceof NotFoundHttpException) {
return redirect('/');
}
return parent::render($request, $exception);
}
don't forget to add
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
on top
2 likes