CFLib.org – Common Function Library Project

cf301Redirect(urlString)

Last updated December 6, 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>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson