-
-
Save theStrangeAdventurer/c5c1160719857c681bb3768b688d2869 to your computer and use it in GitHub Desktop.
БИТРИКС: Подключение шаблона для 404 страницы
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// В админке подключаем шаблон по условию | |
// defined('ERROR_404') && ERROR_404 == 'Y' | |
// в init.php вставляем | |
\Bitrix\Main\EventManager::getInstance()->addEventHandler("main", "OnPageStart", function () { | |
global $APPLICATION; | |
if (!defined('ERROR_404') || ERROR_404 != 'Y') { | |
return; | |
} | |
if ($APPLICATION->GetCurPage() != "/404.php") { | |
header('X-Accel-Redirect: ' . "/404.php"); | |
exit(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment