laravel - How to redirect all wrong URL to login page? -
i want redirect wrong urls people type in (e.g., www.website.com/xwfkjdf, pages don't exist), login page (if they're not logged in) , dashboard if they're logged in.
currently, "notfoundhttpexception" error.
change render
function inside app\exceptions\handler.php
to
public function render($request, exception $exception) { //redirect if route not found if ($exception instanceof \symfony\component\httpkernel\exception\notfoundhttpexception){ return redirect('/'); } return parent::render($request, $exception); }
Comments
Post a Comment