Respond to the client request with a redirect without contacting the origin.

How it works

With this behavior enabled, you can offload your origin from specified redirects and speed up the performance for end-users.

Features and options

FieldWhat it doesSub-options
Redirect TypeRedirect specifically for mobile sites or for all sites.
  • Default
  • Mobile

Destination ProtocolSelect the protocol of the redirect destination URL.
  • Same as request
  • HTTP
  • HTTPS

Destination HostnameSpecify how to change the requested hostname.
  • Same as request
  • Add subdomain to request
  • Substitute requested subdomain
  • Static hostname
Subdomain to AddWith Destination Hostname set to Add subdomain to request, specify the subdomain to prepend the requested hostname. For example, to redirect from www.example.com to m.www.example.com, enter m.
Variable Support: This option supports variable expression syntax. Typing {{ in the option field triggers variable auto complete. Learn more about variable support.
Substitute SubdomainWith Destination Hostname set to Substitute requested subdomain, specify the alternative subdomain to use instead of the requested subdomain. For example, to redirect from www.home.example.com to m.home.example.com, enter m.
Variable Support: This option supports variable expression syntax. Typing {{ in the option field triggers variable auto complete. Learn more about variable support.
Static HostnameWith Destination Hostname set to Static hostname, specify the static (absolute) hostname for the redirect destination URL.
Variable Support: This option supports variable expression syntax. Typing {{ in the option field triggers variable auto complete. Learn more about variable support.
Destination PathSpecify how to change the requested path. Query Strings can be contained, and it will be merged if following "Include Query String" is "Yes"
  • Same as requested
  • Path Prefix and Suffix
  • Static Path
Path PrefixWith Destination Path set to Path Prefix and Suffix, specify any path components to prepend the requested path. For example, to redirect from /example/index.html to /prefix/example/index.html, enter /prefix.
Variable Support: This option supports variable expression syntax. Typing {{ in the option field triggers variable auto complete. Learn more about variable support.
Path Suffix StatusWith Destination Path set to Path Prefix and Suffix, specify whether to include a suffix to your redirect destination.
  • Do not add suffix
  • Add a suffix
Path SuffixWith Path Suffix Status set to Add a suffix, specify the path components to append to the requested path.
Variable Support: This option supports variable expression syntax. Typing {{ in the option field triggers variable auto complete. Learn more about variable support.
Include Query StringIndicate whether to append the query arguments to the destination query string.
Redirect Status CodeSelect the HTTP status code to use in the redirect response.
  • 301 Moved Permanently
  • 302 Found
  • 303 See Other
  • 307 Temporary Redirect

Tips and best practices

You can specify the redirect URL relative to the current root path, or as a fully qualified URL:

  • Fully Qualified URL
    This redirects requests matching the rule to that URL with protocol specified:
    http://www.example.com/example/path/file.ext

  • Relative to Current Root Directory, using a / prefix
    This redirects the request to a different specific path under the same host root directory, using the same protocol:
    /example/path/file.ext

You can also choose to ignore query request parameters, append request parameters to destination parameters, or prefer request parameters over the destination parameters, when available.

Related topics