[TYPO3-dev] An idea to further process ' page not found ' 404handling

Matt - [SwagmanInternet] typo3 at swagmaninternet.com
Wed Apr 30 03:31:50 CEST 2008



"Oliver Hader" <oliver at typo3.org> wrote in message 
news:<mailman.1.1209460616.20978.typo3-dev at lists.netfielders.de>...
> Hi Matt,
>
> Matt - [SwagmanInternet] schrieb:
> > Christopher Torgalson wrote:
> >> On Tue, Apr 29, 2008 at 6:24 AM, SwagmanInternet
> >> <typo3 at swagmaninternet.com> wrote:
> >>
> >> <snip>
> >>
> >>>  Correct 404 page error handling appears to fail for the following
> >>>  requested resources;
> >>>
> >>>                         - www.domain.com.au/file.htm
> >>>                         - www.domain.com.au/file.pdf
> >>>
> >>>                         - www.domain.com.au/folder/
> >>>                         - www.domain.com.au/folder/file.html
> >>>                         - www.domain.com.au/folder/file.pdf
> >> <snip>
> >>
> >>
> >> You should re-chck your setup. All of your examples above and any
> >> variant I can create return a 404 page with proper response header for
> >> me.
> >>
> >> Relevant install tool settings:
> >>
> >> [FE][pageNotFound_handling] = /index.php?id=54
> >> [FE][pageNotFound_handling_statheader] = HTTP/1.0 404 Not Found
> >
> > I forgot to mention my live setup before, so here it is:
> >
> > TYPO3 ver 4.1.4
> >
> > $TYPO3_CONF_VARS['FE']['pageNotFound_handling'] = '/pagenotfound.html';
> > $TYPO3_CONF_VARS['FE']['pageNotFound_handling_statheader'] = 'HTTP/1.0 
> > 404 Not Found';
> >
> > and with this scenario, the above requested resources failed for me, and 
> > also in a few other sites i tested on. m'mmm
>
> What does "failed" mean exactly in your case?

Failed means in this case that the above requested resources get redirected
to the 'root' page of the website rather than getting a 404 and redirected
to the page "/pagenotfound.html".


> Is the URI "/pagenotfound.html" a real file or virtually and should be 
> handled via .htaccess and finally TYPO3?

In this case the "/pagenotfound.html" is a page set up in the website,
page marked as hidden, with an alias set to 'pagenotfound'.
A 404 error & redirection occurs successfully when a page with suffix
.html is called with an alias that does not exist,
for example www.domain.com.au/pagenotexist.html

Therefore the default typo3 .htaccess and setting the following
value works as expected,
$TYPO3_CONF_VARS['FE']['pageNotFound_handling'] = '/pagenotfound.html';

>From my understanding, when a requested resource is called in the browser 
that
does not exist then .htaccess and typo3 takes over this request.
Now, when any requested resource is, a) a file without suffix .html and
does not exist, ie www.domain.com.au/file.pdf it is redirected to the home 
page
of website, the root page, due to $this->id being 'false' and then $this->id 
is
set to '0' in function 'setIDfromArgV()'. Once $this->id is set to '0', then
function checkAndSetAlias() does not change the value of $this->id .
In function fetch_the_id(), $this->id is reset to a value of 1, which is 
what happens
when you pass an argument of '0' to
$theFirstPage = $this->sys_page->getFirstWebPage($this->id)
and this is what redirects a non existent file or resource to the root page 
of a site.

This is why i suggested the Long term fix in my original post, and that was 
to:

NEW function call added inside function fetch_the_id(), and also a 5th key=>
value added to array $pNotFoundMsg
and
NEW function, inserted possibly below function
ADMCMD_preview_postInit($previewConfig)

see original post for additional details on code suggested for
Long term suggested solution for fixing 404 pagenotfound_handling

Matt
SwagmanInternet.com

>
> olly
> -- 
> Oliver Hader
> TYPO3 Core Team 






More information about the TYPO3-dev mailing list