A
A
Alexander Andreev2017-07-26 11:10:54
Apache HTTP Server
Alexander Andreev, 2017-07-26 11:10:54

Why does the 404th error of 1C Bitrix not work?

The site is on a dedicated server, the site is on Bitrix, it has a standard .htaccess

Options -Indexes 
ErrorDocument 404 /404.php

<IfModule mod_php5.c>
  php_value display_errors 1
  php_value mbstring.func_overload 2
  php_value mbstring.internal_encoding UTF-8
  php_value max_input_vars 10000
  php_value pcre.recursion_limit 1000
  php_flag register_globals off
</IfModule>

<IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine On
  RewriteBase /

    RewriteCond %{HTTP_HOST} ^www\.АдресСайта\.ru [NC]
    RewriteRule ^(.*)$ http://АдресСайта/$1 [L,R=301]
    
    #Редирект с index.php и index.html
       RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP
  RewriteRule ^index\.php$ http://АдресСайта/ [R=301,L]
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -l [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteCond %{REQUEST_FILENAME} [\xC2-\xDF][\x80-\xBF] [OR]
  RewriteCond %{REQUEST_FILENAME} \xE0[\xA0-\xBF][\x80-\xBF] [OR]
  RewriteCond %{REQUEST_FILENAME} [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} [OR]
  RewriteCond %{REQUEST_FILENAME} \xED[\x80-\x9F][\x80-\xBF] [OR]
  RewriteCond %{REQUEST_FILENAME} \xF0[\x90-\xBF][\x80-\xBF]{2} [OR]
  RewriteCond %{REQUEST_FILENAME} [\xF1-\xF3][\x80-\xBF]{3} [OR]
  RewriteCond %{REQUEST_FILENAME} \xF4[\x80-\x8F][\x80-\xBF]{2}
  RewriteCond %{REQUEST_FILENAME} !/bitrix/virtual_file_system.php$
  RewriteRule ^(.*)$ /bitrix/virtual_file_system.php [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$
  RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]
  RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>

<IfModule mod_dir.c>
  DirectoryIndex index.php index.html
</IfModule>

<IfModule mod_expires.c>
  ExpiresActive on
  ExpiresByType image/jpeg "access plus 3 day"
  ExpiresByType image/gif "access plus 3 day"
  ExpiresByType image/png "access plus 3 day"
  ExpiresByType text/css "access plus 3 day"
  ExpiresByType application/javascript "access plus 3 day"  
</IfModule>

in general, instead of the 404th, it gives an empty page with a response of 200 ok. The only exceptions are the pages of complex components where the 404 error is handled not by Apache, but by the component itself. What can be a jamb? I think something is not configured on the server (this is not a virtual server, but a dedicated one, it administers it to the client's sys.admin), but what exactly is without a clue.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Gritsuk, 2017-07-26
@winer

In the settings of the main module, you can set the status of the response 200 to the 404th page:
Also in the /404.php file, at the beginning it should be like this:

<?
include_once($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/urlrewrite.php');

CHTTP::SetStatus("404 Not Found");
@define("ERROR_404", "Y");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question