I
I
ingenerdsm2015-05-01 13:29:33
htaccess
ingenerdsm, 2015-05-01 13:29:33

How to make a redirect when changing the category name?

Hello, there was a need to change the name of the directory on the site, that is, now:
site.ru/cat1/ , and after renaming: site.ru/cat2/ and , accordingly, it is necessary that when you navigate from third-party resources via links of the form site.ru/cat1 /page.html , redirection to the same page worked only in the new cat2 directory : site.ru/ cat2 /page.html. PS There are many pages, so it is irrational to prescribe for each.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
gracer, 2015-05-01
@ingenerdsm

Something like this.

RewriteEngine   on
RewriteBase     /
RewriteRule     ^cat1/(.*)$  cat2/$1 [R=301]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question