L
L
Laloo2021-07-22 15:20:59
1C-Bitrix
Laloo, 2021-07-22 15:20:59

How to make a correct Bitrix redirect from a section to another section?

Good afternoon! Even I looked for how to make a redirect, I didn’t find anything, but I didn’t quite understand what I found, since there is no exact answer.

There is a site of the form https://www.website.ru
It is necessary to redirect from all subsections of the section (with a section) to a new one section, of the following types:

1.
https://www.site.ru/ section /all_other_subsections_and_pages_of_subsections/... redirect to https://www.site.ru/ new_section /

2.
https://www.site.ru/section1/ section2/ all_other_subsections_and_subsection_pages / ... redirect to https://www.site.ru/new_section/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2021-07-22
@shambler81

re-read it 20 times in order to at least somehow understand

RewriteCond %{REQUEST_URI} ^/dir1/(.*)$ 
   # если строка начинается с /dir1/ 
RewriteRule ^(.*)$ /dir2/%1 [R=301,L]

RewriteCond %{REQUEST_URI} ^/dir1/dir2(.*)$ 
   # если строка начинается с /dir1/ 
RewriteRule ^(.*)$ /dir3/%1 [R=301,L] 
   #Перенаправить все URL с начинающиеся  на dir3 с сохранением дальнейшей структуры URL

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question