#18754improved 404 pagenotfound_handling not working for certain requested URLs/resources
Description
When using default TYPO3 .htaccess file and with or without ‘simulate static documents’ it appears that 404 pagenotfound_handling works only for requested files:
- that have .html as the file suffix
– and the file being called is requested from the root of a typo3 site, i.e. www.domain.com.au/file.html
If ‘file.html’ exists, page is shown
If ‘wrongfile.html’ does not exist then correct 404 handling takes place
correctly, due to function ‘$this->checkAndSetAlias()’
The ’404 pagenotfound_handling’ feature fails to show the 404 headers 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
When the above requested resources fail, the browser is given a 200 OK http header and is shown the home page of the website with the requested resources URL remaining in the browsers address bar. This could be due to $this->id being ‘false’ and then $this->id is set to ‘0’ in function ‘setIDfromArgV()’.
My suggested code to patch class.tslib_fe.php works on the premise that $this->TYPO3_CONF_VARS[‘FE’][‘pageNotFound_handling’] value is TRUE, but perhaps the TYPO3 404 handling should still work when $this->TYPO3_CONF_VARS[‘FE’][‘pageNotFound_handling’] is FALSE and therefore still show 404 headers and redirect to home page/ root page of website.
Please see attached file(s) class.tslib_fe.modified.php.txt & class.tslib_fe.orig.php.txt to review suggested code as a basis idea working towards possible patching of /typo3/sysext/cms/tslib/class.tslib_fe.php
(issue imported from #M8343)