F
F
FlexStat2018-09-18 22:23:14
1C-Bitrix
FlexStat, 2018-09-18 22:23:14

How can I display another 404 error page in bitrix?

In init.php :

AddEventHandler("main","OnEpilog", "ShowError404");
 
function ShowError404() {
    if (CHTTP::GetLastStatus()=='404 Not Found') {
        global $APPLICATION;
        $APPLICATION->RestartBuffer();
        require $_SERVER['DOCUMENT_ROOT'].SITE_TEMPLATE_PATH.'/header1.php';
        require $_SERVER['DOCUMENT_ROOT'] . '/404.php';
       require $_SERVER['DOCUMENT_ROOT'].SITE_TEMPLATE_PATH.'/footer.php';    
    }
}

The eng version is configured, which has its own 404.php, the problem is that when switching to the English version of the site, the 404.php page is displayed from the main directory of the site, instead of en/404.php
Please tell me how you can solve this problem.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Epifanov, 2018-09-18
@FlexStat

connect 404.php by analogy with the header and footer

require $_SERVER['DOCUMENT_ROOT'] .SITE_TEMPLATE_PATH. '/404.php';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question