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

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -