Z
Z
Zelletro2018-12-20 15:22:58
htaccess
Zelletro, 2018-12-20 15:22:58

How to set up a 301 redirect of a renamed directory?

It is not possible to correctly prescribe the rule for the redirect.
Url can be of the form:
site.ru/aaa/bbb/old
site.ru/aaa/bbb/old/ccc/ddd
Replace old with new.
I tried to modify this rule in different ways, but it
#RewriteRule ^old$ new/ [R=301,L]
did not work out to achieve the desired result.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2018-12-20
@Zelletro

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question