C
C
Chrome Toaster2019-09-11 13:01:02
1C-Bitrix
Chrome Toaster, 2019-09-11 13:01:02

Instead of a 404 error, a 301 redirect?

Good afternoon, instead of 404 errors and showing the page, Bitrix redirects to a higher level:

site/catalog/fdjksnfdksjnfkjsd -> site/catalog (301)
site/dkfmskld -> site (301)
site/contacts/randomstring2______ -> site/contacts (301)

in htaccess:
ErrorDocument 404 /404.php
in 404.php:
include_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/urlrewrite.php');
CHTTP::SetStatus("404 Not Found");
@define("ERROR_404","Y");
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("Страница не найдена");

init.php:
его не существует
urlrewrite.php (at root):
URLREWRITE

<?
$arUrlRewrite = array(
  array(
    "CONDITION" => "#^/bitrix/services/ymarket/([\\w\\d\\-]+)?(/)?(([\\w\\d\\-]+)(/)?)?#",
    "RULE" => "REQUEST_OBJECT=\$1&METHOD=\$4",
    "ID" => "",
    "PATH" => "/bitrix/services/ymarket/index.php",
  ),
  array(
    "CONDITION" => "#^/personal/history-of-orders/#",
    "RULE" => "",
    "ID" => "bitrix:sale.personal.order",
    "PATH" => "/personal/history-of-orders/index.php",
  ),
  array(
    "CONDITION" => "#^/acrit.exportproplus/(.*)#",
    "RULE" => "path=\$1",
    "ID" => "",
    "PATH" => "/acrit.exportproplus/index.php",
  ),
  array(
    "CONDITION" => "#^/bitrix/services/ymarket/#",
    "RULE" => "",
    "ID" => "",
    "PATH" => "/bitrix/services/ymarket/index.php",
  ),
  array(
    "CONDITION" => "#^/acrit.exportpro/(.*)#",
    "RULE" => "path=\$1",
    "ID" => "",
    "PATH" => "/acrit.exportpro/index.php",
  ),
  array(
    "CONDITION" => "#^/contacts/stores/#",
    "RULE" => "",
    "ID" => "bitrix:catalog.store",
    "PATH" => "/contacts/stores/index.php",
  ),
  array(
    "CONDITION" => "#^/contacts/stores/#",
    "RULE" => "",
    "ID" => "bitrix:news",
    "PATH" => "/contacts/stores/index.php",
  ),
  array(
    "CONDITION" => "#^/personal/order/#",
    "RULE" => "",
    "ID" => "bitrix:sale.personal.order",
    "PATH" => "/personal/order/index.php",
  ),
  array(
    "CONDITION" => "#^/info/articles/#",
    "RULE" => "",
    "ID" => "bitrix:news",
    "PATH" => "/info/articles/index.php",
  ),
  array(
    "CONDITION" => "#^/company/news/#",
    "RULE" => "",
    "ID" => "bitrix:news",
    "PATH" => "/company/news/index.php",
  ),
  array(
    "CONDITION" => "#^/info/article/#",
    "RULE" => "",
    "ID" => "bitrix:news",
    "PATH" => "/info/article/index.php",
  ),
  array(
    "CONDITION" => "#^/catalogtest/#",
    "RULE" => "",
    "ID" => "bitrix:catalog",
    "PATH" => "/catalogtest/index.php",
  ),
  array(
    "CONDITION" => "#^/info/brands/#",
    "RULE" => "",
    "ID" => "bitrix:news",
    "PATH" => "/info/brands/index.php",
  ),
  array(
    "CONDITION" => "#^/info/brand/#",
    "RULE" => "",
    "ID" => "bitrix:news",
    "PATH" => "/info/brand/index.php",
  ),
  array(
    "CONDITION" => "#^/products/#",
    "RULE" => "",
    "ID" => "bitrix:catalog",
    "PATH" => "/products/index.php",
  ),
  array(
    "CONDITION" => "#^/services/#",
    "RULE" => "",
    "ID" => "bitrix:news",
    "PATH" => "/services/index.php",
  ),
  array(
    "CONDITION" => "#^/support/#",
    "RULE" => "",
    "ID" => "altasib:support",
    "PATH" => "/support/index.php",
  ),
  array(
    "CONDITION" => "#^/test-bx/#",
    "RULE" => "",
    "ID" => "bitrix:catalog",
    "PATH" => "/test-bx/index.php",
  ),
  array(
    "CONDITION" => "#^/project/#",
    "RULE" => "",
    "ID" => "bitrix:catalog",
    "PATH" => "/project/index.php",
  ),
  array(
    "CONDITION" => "#^/news/#",
    "RULE" => "",
    "ID" => "bitrix:news",
    "PATH" => "/news/index.php",
  ),
  array(
    "CONDITION" => "#^/sale/#",
    "RULE" => "",
    "ID" => "bitrix:news",
    "PATH" => "/sale/index.php",
  ),
  array(
    "CONDITION" => "#^/#",
    "RULE" => "",
    "ID" => "bitrix:catalog",
    "PATH" => "/catalog/index.php",
  ),
  array(
    "CONDITION" => "#^/#",
    "RULE" => "",
    "ID" => "bitrix:catalog",
    "PATH" => "/catalog_test1/index.php",
  ),
);

?>


/bitrix/modules/main/include/urlrewrite.php:
Не существует
Where to look?, tell me please

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Danil Isaev, 2019-09-11
@d4h1i15438

init.php
urlrewrite.php
look most likely here

array(
    "CONDITION" => "#^/#",
    "RULE" => "",
    "ID" => "bitrix:catalog",
    "PATH" => "/catalog/index.php",
  ),
  array(
    "CONDITION" => "#^/#",
    "RULE" => "",
    "ID" => "bitrix:catalog",
    "PATH" => "/catalog_test1/index.php",
  ),

Most likely on the main one there are 2 CNC components, which are not required. What creates a rule that is possible and causes that page instead of 404

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question