Answer the question
In order to leave comments, you need to log in
404 does not work in Bitrix, standard solutions do not help?
404 error does not work on Bitrix.
site.ru/fgsdfgsdg - returns 200 and a white page.
At the same time, in other situations on the site, the error works well:
site.ru/catalog/sfgsdgfsg - gives both the 404 code and a beautiful error page (which excludes the fact that 404 does not work and is not configured in principle)
What has already been checked:
1. In htaccess there is a line ErrorDocument 404 /404.php
2. 404.php is and it has
CHTTP::SetStatus("404 Not Found");
@define("ERROR_404","Y");
AddEventHandler('main', 'OnEpilog', '_Check404Error', 1);
function _Check404Error(){
if(defined('ERROR_404') && ERROR_404=='Y' || CHTTP::GetLastStatus() == "404 Not Found"){
GLOBAL $APPLICATION;
$APPLICATION->RestartBuffer();
require $_SERVER['DOCUMENT_ROOT'].SITE_TEMPLATE_PATH.'/header.php';
require $_SERVER['DOCUMENT_ROOT'].'/404.php';
require $_SERVER['DOCUMENT_ROOT'].SITE_TEMPLATE_PATH.'/footer.php';
}
}
Answer the question
In order to leave comments, you need to log in
Configuring the main module, uncheck "Send status 200 to 404 error in header"
Check that the _Check404Error function is executed.
Replace SITE_TEMPLATE_PATH with your folder.
Download the hosting check script and check for Bitrix compliance, it may be in the server https://www.1c-bitrix.ru/download/scripts/bitrix_s...
Check the urlrewrite.php file at the root to see if there is a rule that matches any request
like this
array (
'CONDITION' => '#^/#',
'RULE' => '',
'ID' => 'bitrix:news',
'PATH' => '/new/index.php',
'SORT' => 100,
),
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question