What CFLOCATION Does
It is often stated that
CFLOCATION does a client side redirect. This means that it sends back some HTTP headers telling your browser to request a different location. This is done with a
302 (Moved Temporarily) HTTP status code, and the
Location header. Here's what the HTTP response might look like:
HTTP/1.1 302 Moved Temporarily Content-Type: text/html; charset=UTF-8 location: /anotherPage.cfm Connection: close Date: Mon, 16 May 2005 18:27:21 GMT Server: Apache
CFLOCATION should only be used for temporary redirects.
For permanent redirects use the 301 HTTP status code, which stands for Moved Permanently. You can do this with the
<cfheader statuscode="301" statustext="Moved Permanently"> <cfheader name="Location" value="https://www.petefreitag.com/"> <cfabort>
It is important that you use the correct status text Moved Permanently as defined by the HTTP RFC.
You might also like:
- New StatusCode Attribute in CFLOCATION - August 1, 2007