location

Stops execution of the current page and opens a CFML page or HTML file.

location(url [, addtoken] [, statuscode]) → returns void

Argument Reference

url string
Required

URL of HTML file or CFML page to open.

addtoken boolean

clientManagement must be enabled (see cfapplication).
Values:
  • true
  • false

statuscode numeric

The HTTP status code

Examples
Sample code invoking the location function

Relocates to a different page if user is not logged in.

if(!structKeyExists(session, "userID") {
    location("login.cfm");
}

Fork me on GitHub