Добавьте строчку после первой
if(preg_match('~^404~i', CHTTP::GetLastStatus())) { include $_SERVER['DOCUMENT_ROOT'].'/404.php'; return; }
в файлы шаблонов
/bitrix/templates/ваш шаблон/components/bitrix/catalog/section.php
/bitrix/templates/ваш шаблон/components/bitrix/catalog/sections.php
/bitrix/templates/ваш шаблон/components/bitrix/catalog/element.php
if(preg_match('~^404~i', CHTTP::GetLastStatus())) { include $_SERVER['DOCUMENT_ROOT'].'/404.php'; return; }
в файлы шаблонов
/bitrix/templates/ваш шаблон/components/bitrix/catalog/section.php
/bitrix/templates/ваш шаблон/components/bitrix/catalog/sections.php
/bitrix/templates/ваш шаблон/components/bitrix/catalog/element.php