Laravel – After login, how to change default redirect to home page

After successful authentication of a user, they are authenticated to /home. /home is the default path which is set by Laravel 5.2/5.3, you can change this by updating redirectTo property in below files:

App/Http/Controllers/Auth/LoginController.php

protected $redirectTo = '/home';

App/Http/Controllers/Auth/RegisterController

protected $redirectTo = '/home';

App/Http/Middleware/RedirectIfAuthenticated.php

if (Auth::guard($guard)->check()) {
return redirect('/home');
}

How to 301 redirect from www domain to non www domain using htaccess

Enable mod_rewrite module in apache.

Setting the “RewriteBase /”, sets the base of the URL to “/”

Replace example.com with your website domain name.



RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301,NC]