S
S
Sergey Demin2020-09-14 21:07:35
1C-Bitrix
Sergey Demin, 2020-09-14 21:07:35

How to register urlrewrite bitrix with dates?

There is such an array in the urlrewrite.php file:

array (
'CONDITION' => '#^/([a-z_-]+)/([\\d]{4}+)/([\\d]{2}+)/([\\d]{2}+)/([\\da-z_-]+)/($|\\?.+$)$#',
'RULE' => 'component=detail&params[sectionCode]=$1&params[year]=$2&params[month]=$3&params[day]=$4&params[itemCode]=$5',
'ID' => 'content.news:detail',
'PATH' => '/local/content.news/index.php',
'SORT' => '7',),


It generates a CNC like: /sport/2020/09/14/anapskie-voleybolistki-vyshli-v-final-pervenstva/

However, the date in the URL is the date the element was created, but how can I make it the date the element was active?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Harakhnin, 2020-09-16
@Chupokabr

The rule in urlrewrite.php has nothing to do with it. This is a template for parsing data from a url.
After parsing, the request is sent to the script /local/content.news/index.php with GET parameters understandable to the script.
If you need to generate a link from the start date of the activity, then you need to fix this in the element url generator. The rules for generating the element's url by default are set in the infoblock settings.
You can also use any of your own templates to generate url, then this is written in the code of the component or module.
You need to search in this direction

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question