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 Permanentlyredirect. When a search crawler sees a
301redirect 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="https://www.petefreitag.com/"> <cfabort>
Now, in ColdFusion 8 you can simply use the
CFLOCATION tag with the
<cflocation url="https://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
Like this? Follow me ↯Tweet Follow @pfreitag
New StatusCode Attribute in CFLOCATION was first published on August 01, 2007.
If you like reading about cflocation, cfml, redirect, or http then you might also like:
The FuseGuard Web Application Firewall for ColdFusion & CFML is a high performance, customizable engine that blocks various attacks against your ColdFusion applications.