I
I
Ilya Malinovsky2018-10-20 17:05:53
htaccess
Ilya Malinovsky, 2018-10-20 17:05:53

How to send 301 Redirect correctly?

Good afternoon! There is a task to write a redirect of 1000 links. I decided to parse them from a file and use a script to generate a redirect line in the following format "Redirect 301 from where to". Everything went ok, but noticed a strange feature.
There is a rule "Redirect 301 /about/ /o-kompanii/" , when visiting /about/ page it redirects as it should, but if you go to /about/123/ it redirects to /o-kompanii/123/ . It shouldn't happen, how can I make sure this doesn't happen? (Limit ^/about/$ doesn't work).
And another question, what about links that have Russian letters and spaces? My htaccess does not see these links and does not redirect

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan Hasanli, 2018-10-20
@iliya936

1) about Cyrillic characters - use punycode
2) about redirecting by regex, use RedirectMatch
3) sometimes if there are extra spaces or tabs between "from where" and "where" then the redirect does not work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question