pf » New StatusCode Attribute in CFLOCATION
August 01, 2007
New StatusCode Attribute in CFLOCATION
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
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="http://www.petefreitag.com/"> <cfabort>
Now, in ColdFusion 8 you can simply use the CFLOCATION tag with the statusCode attribute:
<cflocation url="http://www.petefreitag.com/" statuscode="301" addtoken="false">
According to the documentation the statusCode attribute accepts the following status code values: 300, 301, 302, 303, 304, 305, 307
Related Entries
- What CFLOCATION Does - May 16, 2005
Trackback Address: 648/886A2A3F968D4A1C5AA1AC116C355CC9
Comments
On 08/03/2007 at 6:41:53 AM MDT BigTallGeoff wrote:
1
great info, thanks Pete!
On 03/11/2008 at 3:41:41 AM MST A big thanks! wrote:
2
Recently cflocation on an SQl action page was not protecting me from refresh after redirect. Changed to your solution above and bingo - thanks!
- CFSCRIPT Cheatsheet
- 3 New Image Effects for ColdFusion 8
- Googlebot to Submit Web Forms
- ColdFusion 8 Update 1 Fixes some Image Processing Quirks
- 10 Most Useful Image Functions in ColdFusion 8
- Speaking at NYC CFUG This Week
- Adobe AIR Tutorial for HTML / JavaScript Developers
- INFORMATION_SCHEMA Support in MySQL, PostgreSQL
Subscribe to my RSS Feed:
RSS
RSS
add to del.icio.us
Pete Freitag is a software engineer, and web developer located in










