Stops execution of the current page and opens a ColdFusion page or HTML file.
Flow-control tags, Page processing tags
<cflocation
url = "URL"
addToken = "yes|no"
statusCode = "300|301|302|303|304|305|307">
attributeCollection attribute
whose value is a structure. Specify the structure name in the attributeCollection attribute
and use the tag’s attribute names as structure keys.ColdFusion
8: Added the statusCode attribute.
Attribute |
Req/Opt |
Default |
Description |
|---|---|---|---|
url |
Required |
URL of HTML file or CFML page to open. |
|
|
Optional |
The
|
|
|
Optional |
The HTTP status code, as follows:
The status codes from 304 to 307 do not redirect you to the page specified in a URL, unless you also follow the guidelines specified in the most recent HTTP RFC. |
You might write a standard message or response in a file, and call it from several applications. Use this tag to redirect the user’s browser to the standard file.
This tag has no effect if you use it
after the cfflush tag on a page.
<h3>cflocation Example</h3> <p>This tag redirects the browser to a web resource; normally, you would use this tag to go to a CF page or an HTML file on the same server. The addToken attribute lets you send client information to the target page.</p> <p>If you remove the comments, this code redirects you to CFDOCS home page:</p> <!--- <cflocation url = "http://localhost:8500/cfdocs/dochome.htm" addToken = "no"> --->