Respond to the client’s 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
Field | What it does | Sub-options |
---|---|---|
Redirect Type | Redirect specifically for mobile sites or for all sites. |
|
Destination Protocol | Select the protocol of the redirect destination URL. |
|
Destination Hostname | Specify how to change the requested hostname. |
|
Subdomain to Add | With 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. |
|
Substitute Subdomain | With 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. |
|
Static Hostname | With 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 Path | Specify how to change the requested path. |
|
Path Prefix | With 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. |
|
Path Suffix Status | With Destination Path set to Path Prefix and Suffix, specify whether to include a suffix to your redirect destination. |
|
Path Suffix | With 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 String | Indicate whether to append the query arguments to the destination query string. | |
Redirect Status Code | Select the HTTP status code to use in the redirect response. |
|
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 the 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.