Bug #15130
closedError 404: Page not found handling not working correctly with SimulateStaticDocuments=1
0%
Description
we encountered in several typo3 setups with simulatestaticdocuments = 1 problems with the page finding routines of typo3.
if the desired page is not found, the startpage will be displayed, instead of an "Page not Found" error message from typo3.
we reported this in greater detail already to the list and found several other posts regarding this issue.
our last post in the german list was:
news://lists.typo3.org:119/mailman.1.1124349483.17194.typo3-german@lists.typo3.org
(issue imported from #M1694)
Updated by svobi about 19 years ago
i've searched in the tslib and t3lib files that are used from index_ts.php
in the file class.t3lib_page.php the following function returns 0 if it can't find the alias in the database. and returning 0 seems to always display the mainpage.
/**
* Returns a pagerow for the page with alias $alias
*
* @param string The alias to look up the page uid for.
* @return integer Returns page uid (integer) if found, otherwise 0 (zero)
* @see tslib_fe::checkAndSetAlias(), tslib_cObj::typoLink()
*/
function getPageIdFromAlias($alias) {
$alias = strtolower($alias);
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'alias='.$GLOBALS['TYPO3_DB']->fullQuoteStr($alias, 'pages').' AND pid>=0 AND pages.deleted=0'); // "AND pid>=0" is because of versioning...
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
return $row['uid'];
}
return 0;
}
if i change the return value to -1 it seems like it works like it should. the typo3 internal error404 handling triggers and displays the correct error 404 page i've configured.
but the problem with incorrect http-header still remains.
it sents 302 moved an redirects to the page that should display the error.
:-(
Updated by Dmitry Dulepov almost 19 years ago
I posted the following solution to the "english" list:
- set in localconf.php:
$TYPO3_CONF_VARS["FE"]["pageNotFound_handling"] =
'READFILE:/path/to/site/404.html';
$TYPO3_CONF_VARS["FE"]["pageNotFound_handling_statheader"] =
'HTTP/1.0 404 Not found';
(make sure you point to existing file!)
- change .htaccess from
RewriteRule .* index.php [L]
to
RewriteRule ^[^/]*\.\d+\.\d+\.html$ index.php [L]
This way 404 is returned properly. Also Google sitemaps work with this solution.
Updated by Sebastian Kurfuerst almost 19 years ago
Hi,
I think that's the same issue, isn't it?
Greets, Sebastian
Updated by Michael Scharkow almost 19 years ago
The bug concerning non-existant aliases is treated in the related issue, so I'll only fix the HTTP headers issue here if you agree.
Updated by Michael Scharkow almost 19 years ago
Incorrect HTTP headers are fixed in CVS, to set this yourself see Dmitry's comment.
Updated by Chris topher over 10 years ago
- Assignee deleted (
Michael Scharkow) - Target version deleted (
0) - TYPO3 Version changed from 3.8.0 to 3.8
- PHP Version deleted (
4) - Is Regression set to No