CFLib.org – Common Function Library Project

cf301Redirect(urlString)

Last updated December 06, 2008

author

Erik Vold

Version: 0 | Requires: CF6 | Library: UtilityLib

Description:
Takes a url and 301 redirects to user to that url. Please note - ColdFusion 8 adds the statusCode attribute to be cflocation. This UDF should only be used in ColdFusion 6 and 7.

Return Values:
Returns nothing.

Example:

<cfset cf301Redirect( 'http://google.com' ) />

Parameters:

Name Description Required
urlString URL to push the user to. Yes

Full UDF Source:

<!---
 Takes a url and 301 redirects to user to that url.
 
 @param urlString      URL to push the user to. (Required)
 @return Returns nothing. 
 @author Erik Vold (erikvvold@gmail.com) 
 @version 0, December 6, 2008 
--->
<cffunction name="cf301Redirect" access="public" returntype="void" output="false">
  <cfargument name="urlString" type="string" required="yes" />
  
  <!--- 301 redirect the user to the provided url --->
  <cfheader statuscode="301" statustext="Moved permanently" />
  <cfheader name="Location" value="#arguments.urlString#" />
</cffunction>

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson