We are re-platforming for a client, and they are concerned about SEO. Their current site supports SEO friendly URLs, and so does the new platform. So for those, we are just going to create the same URL mapping. However, they have a large number of other URLs that are not SEO friendly that they want to permanently redirect. These do not follow a similar pattern, so one regex in an .htaccess won't cut it. What is the best way to handle this on a LAMP stack? The application has a front controller too, so I need to make sure that works along with the hard redirects.
+3
A:
One approach (the one I chose) was to create a simple table of old urls and new ones, and then use mod_rewrite to read the table and perform redirects. The table can live in a file external to the Apache config.
Alternatively, you could write a script to query a database if you wanted the table to live in a database.
This means you either need to manually create the mapping, or write some script to output this mapping file.
pkaeding
2008-10-28 21:19:44
A:
You could use PHP to redirect old URLs to new ones.
header("Location: /new.html",TRUE,301);
You will still need to redirect requests to this PHP script, but you may find this more flexible and easier to debug than exclusively using mod_rewrite.
Liam
2008-10-29 10:20:15