Skip to content

Instantly share code, notes, and snippets.

@theStrangeAdventurer
Last active July 31, 2019 07:06
Show Gist options
  • Save theStrangeAdventurer/c5c1160719857c681bb3768b688d2869 to your computer and use it in GitHub Desktop.
Save theStrangeAdventurer/c5c1160719857c681bb3768b688d2869 to your computer and use it in GitHub Desktop.
БИТРИКС: Подключение шаблона для 404 страницы
// В админке подключаем шаблон по условию
// 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