i made simple resume site with laravel 5.4 and i wanna if users type anything except my site name and my site.com/panel automatically redirect to 404 page.
how can i do that?
is there any route to do that or what?
i found this code but not use
public function render($request, Exception $e)
{
if ($e instanceof
\Symfony\Component\HttpKernel\Exception\NotFoundHttpException){
return response(redirect(url('/')), 404);
}
return parent::render($request, $e);
}
just add abort
method
return abort(404);
it's automatically redirect to your resources/views/errors/404.blade.php
return abort(404);
and set your routes too for this particular action/method with get request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With