“Moved Permanently” – The CF Solution

Posted: March 11, 2007 in ColdFusion

Hello World,

Last week I was working on a task that required some redirection of the user. I found my solution and was about to blog about it when I started to catch-up on my ColdFusion Weekly podcasts. That’s when I heard that the CF_Quiz for version 2.07 was excatly what my task and blog was about. So I decided, just to be fair, to wait until after the deadline before publishing this article.

Have you ever wanted to know how to redirect an out-of-print web page to another location? You may find that the CFLocation tag does a client-side redirect telling your browser to go to another page. A portion of the HTTP response header would look like this:

HTTP/1.1 302 Moved Temporarily
Content-Type: text/html; charset=UTF-8
location: /anotherPage.cfm

However you may quickly find that this is a temporary move. In order to tell the browser that this is a permanent move you need to send a HTTP 301 status code and a location header in the HTTP response of the deprecated web page.

Here is the ColdFusion code that will send the HTTP 301 status code and set the location header:

<cfheader statuscode="301" statustext="Moved Permanently">

<cfheader name="Location" value="https://therush.wordpress.com/2007/03/04/signs-of-apollo/">


Good Luck



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s