R
R
RuRoman2021-10-12 11:56:46
Apache HTTP Server
RuRoman, 2021-10-12 11:56:46

How to configure CNC for Bitrix for a specific page?

There is a page on the Bitrix website with a calculator, you can go to it without parameters:
example.ru/calc/

Either with parameters:
example.ru/calc/?type=123

Parameters are transmitted by GET, in type (numeric
)
example.ru/calc/123

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}]


Tried:
RewriteCond %{QUERY_STRING} (^|&)type\=($|&) [NC]
RewriteRule ^calc/?type=$1 calc/$1 [L]

RewriteRule ^calc\/(.*)$ calc/?type=$1 [L]

RewriteRule ^(.+)$ calc/$1 [QSA,L]


Added after
RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]

It doesn't work, I'm doing something wrong, but I can't figure out where the error is

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rucklless, 2021-10-12
@RuRoman

Add to the end of the urlrewrite.php file

array(
    "CONDITION" => "#^/calc/([0-9]+)$#",
    "RULE" => "type=\$1",
    "PATH" => "/calc/index.php",
  ),

R
RuRoman, 2021-10-12
@RuRoman

It almost worked for me, I also had to remove the "\" in the line, otherwise the variable would not come...
'RULE' => 'type=$1',

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question