Redirect

This function redirects a landing page to a specified URL.

NOTE: Any code that appears before the Redirect function will be interpreted, but any code that appears after the function will not.

Argument

Redirect(1)

Ordinal Type Required Description
1 String True The redirect URL

Example

An email is sent with a link to a landing page created in CloudPages. The link uses the CloudPagesURL function to include a field as a URL parameter, based on a value in the Sendable Data Extension.

<a href="%%=CloudPagesURL(123,'src',Source)=%%">view your product page</a>

The landing page includes the following code:

%%[

var @source
set @source = QueryParameter('src')

InsertData("Click Data", "Source", @source, "Subscriber Key", _subscriberKey)
Redirect(concat("https://limedash.com?src=", @source))

]%%

Output

When the page loads, the src URL parameter value is retrieved from the encrypted query string and inserted into a Data Extension with the Subscriber Key.

The page then returns a 302 HTTP status code and redirects the user agent to the defined URL, passing the URL parameter value that was concatenated to the URL; for example https://limedash.com?src=email.