Redirection if user not logged in to a subpage in V11

Hello,

We have pages and subpages that are limited to a user group.
When we try to access the subpages without being logged in, we had in the version of TYPO3 7 made a userFunc that made the redirections that after login redirects to the requested subpage.

Now we are in TYPO3 11, and when we try to access the subpages without being logged in, we get a 403 error so we can’t use the userFunc.

I don’t know how to do it.
I managed with the documentation to make a redirection to the login page when a 503 error occurs in the config.yml. But then, I am not redirected directly to the requested subpage.