We are replacing a website with a new version. The domain is the same, but URL aliases in the new website are different.
In many cases, I can use an old alias to calculate its corresponding new alias. There are many thousands of old aliases, so I don't want to just use the Redirect module. I know how to write the calculations and how to check if a calculated new alias exists.
I need to know at what point I can intercept each incoming URL to calculate a new alias.
I also need to know how to redirect to the calculated new alias if it exists.
Concrete example:
A book chapter on the old site is at example.com/recent/secrets-to-success/10-knowing-when-to-quit
. This chapter on the new site is at example.com/secrets-to-success/knowing-when-quit
. The difference is (a) we no longer add the recent
subfolder, (b) we've removed chapter numbers from chapter titles, and (c) we've changed which words are ignored when an alias is auto-generated.
When someone uses an old alias, I want to intercept it, calculate the new alias, check if it exists, and redirect to it if it does. This is only one example. There are several other ways of calculating, so there's some trial and error involved. But I know how to take care of that.