简体   繁体   English

TYPO3 404错误页面重定向到主页

[英]TYPO3 404 error page redirect to home page

TYPO3 redirects to home page instead of showing 404 error page content. TYPO3重定向到主页,而不是显示404错误页面内容。

Here is my configuration : 这是我的配置:

$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'error-404';
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling_statheader'] = $_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found';

If I visit http://example.com/index.php?id=33333 (which is a non-existing page) it works fine. 如果我访问http://example.com/index.php?id=33333 (这是一个不存在的页面),则可以正常运行。 But if I visit http://example.com/sdafsdfasdfpi (which is also a non-existing page), it redirects me to the home page. 但是,如果我访问http://example.com/sdafsdfasdfpi (这也是一个不存在的页面),它会将我重定向到主页。

Does someone know how to fix that? 有人知道该如何解决吗?

Thanks 谢谢

As the comment by Heinz Schilling indicates, the problem may be in your realurl configuration. 正如Heinz Schilling的评论所指出的那样,问题可能出在您的realurl配置中。

Check your typo3conf/realurl_conf.php for postVarSet_failureMode : 检查您的typo3conf / realurl_conf.php中的postVarSet_failureMode

$TYPO3_CONF_VARS['EXTCONF']['realurl'][...]['init']['postVarSet_failureMode']

It should be assigned with an empty string. 应该为它分配一个空字符串。 If the value is 'postVarSet_failureMode' => 'redirect_goodUpperDir' then the behavour is to redirect to the start page, so that may be the reason. 如果值为'postVarSet_failureMode'=>'redirect_goodUpperDir',则行为是重定向到起始页,因此可能是原因。

Additionally, it might be helpful to post your realurl configuration as well as your TYPO3 version and realurl version number. 此外,发布您的realurl配置以及TYPO3版本和realurl版本号可能会有所帮助。

In your LocalConfiguration.php file add below line. 在您的LocalConfiguration.php文件中,添加以下行。 check php function curl is enable or not in your php.ini file. 检查php函数curl是否在php.ini文件中启用。 if curl is disable then first enable this function.. 如果禁用curl,则首先启用此功能。

'FE' => [
   'pageNotFound_handling' => 'error-404' // Set your error page
],

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM