When creating a new website or changing website structure, it’s important to redirect old pages to new pages using HTTP status code 301 permanent redirect. Here is what you can do when moving your domain from ColdFusion to PHP and the new server does not support ColdFusion.
What is this all about?
Ok.. think about this: Your old website was developed in ColdFusion (.cfm) and used FarCry CMS. Over the years search engines indexed your site and your pages appear on page 1 for your main keyword.
Now, you decided to upgrade your website and move, for example, to WordPress. In order to keep the rankings you need to “tell” search engines that the page has moved to the new URL, using HTTP status code 301. Next time a search engine comes to index the webpage, instead of status code “200 -OK” it will get “301 Moved permanently” and it will update the URL without loosing your page ranking.
Dynamic URLs and 301 Redirect
The easiest way to setup 301 redirects is by using htaccess file or in-page PHP or ColdFusion code. It’s very easy for static pages and there are lots of examples of these on the web.
Things get difficult, however, when redirecting dynamic pages and it’s easy to get lost with mod_rewrite directives etc. Here is another, in my view, easier solution to to address this problem.
So, here is the deal – using a real example from my latestÂ project.
OLD URL: http://www.chooselifeaustralia.org.au/index.cfm?objectID=A5A85D73-65BF-EBC1-2EF5E7AB2D32D250
NEW URL: http://www.chooselifeaustralia.org.au/life/the-culture-of-death/
And the new hosting plan does not support ColdFusion.
Here is what I did.
1. I adjusted the new hosting account to process .cfm pages as PHP. Normally this can easily be done from the hosting control panel. Just to go “Apache Handers” and add handler “application/x-httpd-php5″ with extension “.cfm” to the list (this is for PHP5).
2. Create index.cfm file containing a list of case conditions. Here is an example:
That’s it! Hope this helps.