Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Davidonzo's avatar

Redirect to home and not to last page when session timeout

Hi, I have an application where authentication is mandatory for all web pages. When session expires, my app returns to login. After login, it opens the last opened page, but I want it to open always the home page, since users might change their role after login and a page may not be accessible with default privileges.

The question is: how and where may I set a Laravel app to redirect always to the home page?

I see that the RedirectIfAuthenticated middleware and the LoginController, on authentication, redirect to home. Yet, after timeout these instructions are ignored.

Any clue?

0 likes
2 replies
Dry7's avatar
class LoginController extends Controller {
    protected $redirectTo = '/home';
}
Davidonzo's avatar

$redirectTo is still set correctly, but after session timeout it is ignored.

Please or to participate in this conversation.