D
D
Denis2020-09-21 13:19:43
1C-Bitrix
Denis, 2020-09-21 13:19:43

How to create a Rule for UrlRewrite?

Good afternoon. Help compose rules for UrlRewrite to get variable.

There is a page /brands/#brand_name#/?section=2
It needs to open at the address for example /brands/#brand_name#/2/

There is a page /brands/#brand_name#/?section=divany
It needs to open at the address for example /brands/#brand_name#/divany/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kudis, 2020-09-21
@kallifan

[
    'CONDITION' => '#^/brands/[^/]+/([\d]+)/(\?.+|$)#',
    'RULE' => 'SECTION_ID=$1&REST=$2',
    'ID' => '',
    'PATH' => '/catalog/index.php',
    'SORT' => 1
],
[
    'CONDITION' => '#^/brands/[^/]+/([^/]+)/(\?.+|$)#',
    'RULE' => 'SECTION_CODE=$1&REST=$2',
    'ID' => '',
    'PATH' => '/catalog/index.php',
    'SORT' => 2
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question