E
E
easymade2016-03-13 14:03:50
htaccess
easymade, 2016-03-13 14:03:50

301 redirect on the site?

Hi all. Please tell me how to make a correct redirect through htaccess in this case. The links were like mysite.ru/katalog-tovarov/vannyi-chugunnyie/ and now the directory is not in the new structure. That is, the links will all be of the form mysite.ru/vannyi-chugunnyie/. And so on the whole site. That is, you need to skip the katalog-products section through a 301 redirect. Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artyom Lipovka, 2016-03-13
@partizanes

RewriteRule ^(.*)/old-catalog/(.*)$ $1/new-catalog/$2 [R=301,L]

I guess it's possible like this
RedirectMatch 301 /katalog-tovarov/vannyi-chugunnyie/(.*) /vannyi-chugunnyie/$1

V
Viktor Taran, 2016-03-21
@shambler81

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question