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

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -