I'm working on a SEO/Human friendly URL solution for a large website.
All the links on the website will remain in their old lengthy format, however I would like the user only ever see new nicely formatted urls in their browser bar.
old - domain.com/blah/blah/blah/index.cfm?id=12345
new - domain.com/area_name/12345-short-title
The area name and short title are only available through the database, so I intend to setup an apache rewrite rule to forward all OLD URLs to a 'redirect.cfm'
The redirect.cfm will build the new URL and perform a 301 redirect to it.
Apache rewrite will pick up the new URL and this time send it to 'content.cfm' to display the content.
Hitting the database every time a URL is requested seems excessive, and it has been suggested when I build the new URL I also add a new line in the htaccess file, a 301 redirect, so next time database access is not required.
I predict at least 50,000 redirects being created, after some Google searching I am unsure on whether this is an efficient solution. I saw another post in this forum which said
I do not know what virtual host config is, or whether I can append it via ColdFusion. Can anyone help me out with a viable solution?If you're on a dedicated server, at least put everything in your virtual host config as that's loaded in RAM when Apache starts up. .htaccess is a poor man's solution to Apache configuration. It should only be used when you have no other choice.