L
L
LebedevStr2016-03-13 12:53:20
Apache HTTP Server
LebedevStr, 2016-03-13 12:53:20

How to arrange complex redirects?

Hello. There is a small project. Under 10k visits. Thinking about moving to a new software. There was a problem with the move, namely with the redirect, because the engines differ in the URL structure.
Example of the address of the old page
site.ru/articles/name_article
Example of the address of the new page
site.ru/articles/155-name_article.html
A 301 redirect from site.ru/articles/name_article to site.ru/articles/155-name_article.html should work .
There are no problems in .html. Here simple htaccess rules can be dispensed with. But with 155 - this is the ID of the object, the problem. How to link the address of old pages with new ones, where there is an ID, I can’t imagine. You can of course make htaccess 100 mb. (just to score everything manually), but this is not correct.
Tell me, maybe there is a module for Apache for such situations.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IceJOKER, 2016-03-13
@LebedevStr

And what is difficult?
On the article selection page, check the current request ends with html or not, if it ends with html, then with a regular expression, something like ~^\d-(.*?)\.html$~ , pull out the alias and, accordingly, the article itself by alias, then we can redirect to a new link, or leave the old one.
And if you have two articles with the same aliases, then it’s already more difficult, you can either send to the first one that comes across or create an intermediate page where the user can choose which one to go to (naturally, search engines will also follow the new links and re-index).
The simplest task, if there are not enough brains, then freelance

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question