M
M
multiscripter2018-07-27 13:41:47
1C-Bitrix
multiscripter, 2018-07-27 13:41:47

How to configure the CNC in the bitrix.news component?

Hello.
Problem: with the CNC turned on, the text of the news is not displayed on the detailed view page of the news.
To display news, I use the bitrix.news complex component.
The list of news is displayed at: bitrix-biz.com/novosti
With the CNC turned off, the link to the news in detail looks like: http://bitrix-biz.com/novosti/?ELEMENT_ID=%ID%
where %ID% is the news identifier.
With the CNC turned on, the link to the news in detail looks like: http://bitrix-biz.net/novosti/%ID%/
where %ID% is the news identifier.
Infoblock settings:
5b5af49204118426323384.png
CNC component settings:
5b5af4ad301c8496880558.png
urlrewrite.php in the root of the news site there is the following entry:

array (
    'CONDITION' => '#^/novosti/#',
    'RULE' => '',
    'ID' => 'bitrix:news',
    'PATH' => '/novosti/index.php',
    'SORT' => 100,
  )

With the CNC turned off, everything works in the component: both the "news list" page and the "news details" page.
With CNC enabled in the component on the "news details" page, the text of the news is not displayed.
Help to properly configure the CNC of the bitrix.news component. Is it possible to do this only through the gui (without "picking in the code")?
.htaccess in site root:
Options +Indexes 
ErrorDocument 404 /404.php

<IfModule mod_php5.c>

  php_flag session.use_trans_sid off
  
  php_value display_errors 1
  
  php_value mbstring.func_overload 2
  php_value mbstring.internal_encoding UTF-8
  
  php_value max_input_vars 10000
</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_REFERER} http://bot.net/
    RewriteRule .* http://bitrix-biz.net [R=301,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php [L,QSA]
</IfModule>

<IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine On
  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>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2018-07-27
@multiscripter

check if .htaccess works and if there are conditions for mod_rewrite in it
remove section
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_REFERER} bot.net
RewriteRule .* bitrix-biz.net [R=301,L]
RewriteCond %{REQUEST_FILENAME} !- f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php [L,QSA]

R
Roman Morozov, 2021-10-11
@Q_BASIC

here is a complete instruction for setting up the CNC in Bitrix
If in the section with a complex component Bitrix tells you that there is no page, you may have the following error:
The CNC is configured to work with character codes, but they are not filled in
Different CNC settings in the parameters of the component and infoblock.
Record not created in urlrewrite.php
Broke .htaccess

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question