TYPO3: 404 for restricted access page instead of login form

I have a link pointing to restricted page. When I access the link directly in logout status, its redirect to 404. Actually it should redirect to login form.

I tried:

config {
   typolinkLinkAccessRestrictedPages=PAGE_ID 
   typolinkLinkAccessRestrictedPages_addParams = &return_url=###RETURN_URL###&pageId=###PAGE_ID###
   }

Not working.

Also I tried the login status redirect plugin, no use.

Anyone know how to do this? I am using TYPO3 version 4.4.8.


As this is still unanswered, does this help?

# Check if user is logged in:
[usergroup = *]
# do something
[else]
page.config >
page.config.additionalHeaders = Location: http://www.yourdomain.org/login.html
[end]

I recently posted this to another questions and it crossed my mind that it might be a suitable workaround for your probem.

Found here


I'm not sure how to make redirection work correctly, but perhaps a bit of background will be helpful.

typolinkLinkAccessRestrictedPages only interacts with link generation. That way, anywhere you have a link to an access restricted page, you should get a link that points to the "PAGE Id" page. I suspect you are using your login pid in place of PAGE Id, which I guess should work, but I haven't used this particular feature. I have typolinkLinkAccessRestrictedPages = NONE which makes all links show up, linked to the correct url, but only users who are logged in will successfully load those pages.

If anyone, without being logged in, uses a bookmark to an access restricted page, or they click on one of these links, or directly type in the address, or whatever, they will run into TYPO3's 404 handling (with the error message: ID was not an accessible page). To change how TYPO3 handles these errors, you need to change what TYPO3 does via this setting in localconf.php:

$TYPO3_CONF_VARS["FE"]["pageNotFound_handling"]

I don't know if there's a clean way to just automatically redirect to the login page without hacking the pageNotFound_handling.

As far as the typoscript solution, that wouldn't work for my site, because the trigger isn't whether or not someone is logged in (often they will not be logged in)--the trigger for my site is trying to access a protected page when you are not logged in. I don't want it to redirect everyone who isn't logged in because a lot of pages don't require any login.


And I found an other workaround that looks like it should work fine.

# pages and subpages starting at 123 and 321 are restricted
[PIDinRootline = 123,321] && [loginUser = ]
    page.headerData.666 = TEXT
    page.headerData.666 {
        data = getIndpEnv:TYPO3_REQUEST_URL
        wrap = <meta http-equiv="refresh" content="0; URL=/passwort/?referer= | " />
    }
[global]

Important notice : Do not restrict the complete page, only all contents of the page. Otherwise RealURL will trigger the 404 handler.

At the moment page.config.additionalHeaders (like used by @Mateng) does not support stdWrap, though you cannot add a referrer to redirect to the desired page after login (see TYPO3 Forge and vote for feature request).

链接地址: http://www.djcxy.com/p/8472.html

上一篇: 如何根据推介流量隐藏我的网页上的某些元素?

下一篇: TYPO3:404代表登录表单的受限访问页面