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

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -