Support the ongoing development of Laravel.io →
posted 8 years ago
Session

Hello, im new in Laravel. Have problem with automatic logout after session expire and redirect on home page.

When session expire, redirect me on domain.com/public/auth.signin and show custom 404 error page.

How can I redirect on home page?

Thanks, Marko S.

Last updated 3 years ago.
0

you just set redirection in Auth Controller protected $redirectTo = '/home'; Auth middleware return redirect()->guest('login');

0

Thanks

public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->guest()) { if ($request->ajax() || $request->wantsJson()) { return response('Unauthorized.', 401); } else { return redirect()->guest('signin'); } }

    return $next($request);
}

this is my new code i think this working now

0

Sign in to participate in this thread!

Eventy

Your banner here too?

mares992 mares992 Joined 15 Sep 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.