redirect

Redirects the current page to a given URL.

<@ redirect { options } @>

Options

url String
The URL to redirect the page to.
code 301|302
The HTTP response code to be used. The default is 302.

Example

A good example for a redirect is a search results page with automatic redirection for queries with only a single matching page:

<@ if @{ ?search } and @{ :pagelistCount } = 1 @>
  <@ foreach in pagelist @>
    <@ redirect { url: @{ url } } @>
  <@ end @>
<@ end @>
queryStringMerge set