New StatusCode Attribute in CFLOCATION

August 01, 2007

When ColdFusion 7 came out I did a series of blog entries on small often overlooked new features. Well ColdFusion 8 is now out, and I thought it would be a good idea to do the same.

One handy new feature in ColdFusion 8 is the statusCode attribute in the CFLOCATION tag. I wrote a blog entry a while back called What CFLOCATION Does? - it explains that CFLOCATION does an HTTP 302 Moved Temporarily

redirect. Often times for SEO reasons you will want to do an HTTP 301 Moved Permanently redirect. When a search crawler sees a 301 redirect it forward all pagerank, backlinks, google juice, whatever you want to call it - on to the new url.

In the past you would have had to do something like this to do a 301 redirect with ColdFusion:

<cfheader statuscode="301" statustext="Moved Permanently">
<cfheader name="Location" value="">

Now, in ColdFusion 8 you can simply use the CFLOCATION tag with the statusCode attribute:

<cflocation url="" statuscode="301" addtoken="false">

According to the documentation the statusCode attribute accepts the following status code values: 300, 301, 302, 303, 304, 305, 307

Like this? Follow me ↯

You might also like:

14 people found this page useful, what do you think?


great info, thanks Pete!
thanks for the cool info, I wasn't aware of this

Foundeo Inc.