Answer the question
In order to leave comments, you need to log in
How to redirect via .htaccess by replacing part of the address?
There was a section
https://site/catalog/section_1/sub_sec_1/sub_sect_2/
You need to redirect to
https://site/catalog/section-sub_sect_2/
i.e. add section- and add the last section to the address.
I tried it, it doesn't work
RewriteCond %{REQUEST_URI} ^(.*)/catalog/(.*)$
# если строка содержит /dir1/
RewriteRule ^(.*)$ %1/catalog/section-%2 [R=301,L]
#Перенаправить все URL с начинающиеся с dir1 на dir2 с сохранением дальнейшей структуры URL
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question