L
L
Loonerd22020-12-21 15:59:28
htaccess
Loonerd2, 2020-12-21 15:59:28

Why 301 redirect does not lead to the right link?

There are a number of links at the sub.domain.ru address, and when accessing them, a 301 redirect should work. I inserted this code into htaccess, everything redirects successfully:

Redirect 301 /first/second https://domain.ru/first/second

When accessing sub.domain.ru/first/second, a redirect to domain.ru/first/second occurs.

But there is also another link, for which, for some reason, the redirect rule does not work correctly. Example:

Redirect 301 /first/second/link https://domain.ru/first/second/link12

Domain.ru/first/second/link will open, although according to my expectations it should domain.ru/first/second/link12

What am I missing? Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
wisgest, 2020-12-21
@Loonerd2

Relatively speaking, the rule Redirectdoes not act on the exact link, but on the initial part of the path, preserving its remaining part. Your second link falls under the first rule. Change the order of the rules.

M
mahmudchon, 2020-12-21
@mahmudchon

If the server is configured correctly to work with these instructions, the browser may also cache redirects. Try to work out this option after clearing the cache or in incognito mode.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question