Using one directory with different aliases using .htaccess Using one directory with different aliases using .htaccess codeigniter codeigniter

Using one directory with different aliases using .htaccess


The risk you take is messing up your new clean code for historical reasons (and the guy coming next you will say, WTF, this is a mess!).

For me the right solution would be handling the url migration in apache and not in your application. Every refferenced url that you do not want to keep should get a 410 - Gone message (think about referenced images for example) and every referenced page which have a new matching page should get a 301 - moved permanently redirection on the right page. Then after some time as gone check the access log of your server, and if nobody checks the old url anymore then remove the rules.

If you know every old url and every matching url then use a matching url file (or hash file, faster) and manage the redirection 301 with rewriteMap. You can have a really big number of files in a hash file, the match should be fast. And it should be a temporary function, waiting for robots to fix the urls.