Search code examples
typoscripttypo3-10.x

typo3 not redirect to login page


I'm using typo3 10.4.8

What i want to do is to redirect to login page when an unauthenticated uesr is trying to access a restricted access page (by direct URL, or when refresh a page and the session is expired) to avoid the 404 error:

Page Not Found

The page did not exist or was inaccessible. Reason: ID was not an accessible page

I've tried this knowed solution:

[!frontend.user.isLoggedIn]
    page.config.additionalHeaders{
        10.header = Location: https://linktomyloginpage
}
[END]

It doesn't work but work on public pages. Maybe the system redirects to 404 before the typoscript is executed?

Any advice how to do this?

Thanks


Solution

  • In order to achieve your redirection, I suggest you to use the "Site configuration > Error handling", there you can redirect to a specific page when you have a 403 error (i.e. forbidden).

    enter image description here