I have about 6000 URLs that need to be redirected after changing the CMS. All those URLs are stored in a DB table together with an ID that allows me to tell what is being referenced. Using this table I could generate one huge .htaccess with a lot of Rewrite rules but I suspect that is very inefficient. What's the best way to go? As far as I can tell there are two options:
- Using a RewriteMap where the key is the old URL (it contains no ID, just text, so it has to be the whole thing). I wonder if having 100-150 char long keys is gonna work well.
- Generating a DB table that exactly matches every old/new URL pair and calling some small script to make the redirect.
(Could be summed up as: Is a hash map stored in the filesystem more efficient than a indexed DB table?)
Second part of the question. The new URLs contain the ID of the page being invoked. Something like
If instead I call
I get a 301 Redirect to the correct URL. Should I bother to generate the exact new URL or is it ok to concatenate two redirects? This means either storing just an ID or the whole new URL.