Utility Function: PermanentRedirect()

I really can't take any credit for this one. The idea and the core code come from Pete Freitag's blog post "What CFLOCATION Does". Its probably not even original to wrap it in a function, but here it is any way.


<cffunction name="PermanentRedirect" output="false" returntype="void">
    <cfargument name="url" type="string" required="false" />
    
    <cfheader statuscode="301" statustext="Moved Permanently" />
    <cfheader name="Location" value="#arguments.url#" />
    
    <cfabort />
    
    <cfreturn />
</cffunction>

 
Comments are not allowed for this entry.
Jon Hartmann, July 2011

I'm Jon Hartmann and I'm a Javascript fanatic, UX/UI evangelist and former ColdFusion master. I blog about mysterious error messages, user interface design questions, and all things baffling and irksome about programming for the web.

Learn more about me on LinkedIn.