redirect
Version: v2025-01-13 | Includes use: Yes |
---|
Behavior name: Redirect
Respond to the client request with a redirect without contacting the origin. Specify the redirect as a path expression starting with a /
character relative to the current root, or as a fully qualified URL. This behavior relies primarily on destination_hostname
and destination_path
to manipulate the hostname and path independently.
See also the redirectplus
behavior, which allows you to use variables more flexibly to express the redirect's destination.
Default behavior
These samples reflect the behavior's default settings. You can use these as is in your configurations or make adjustments based on the behavior's available options.
data "akamai_property_rules_builder" "redirect" {
rules_v2025_02_18 {
name = "Redirect"
comments = "Responds to the client request with a redirect without contacting the origin."
behavior {
redirect {
mobile_default_choice = "DEFAULT"
destination_protocol = "SAME_AS_REQUEST"
destination_hostname = "SAME_AS_REQUEST"
destination_path = "OTHER"
destination_path_other = ""
query_string = "APPEND"
response_code = 302
}
}
}
}
"behaviors": [
{
"name": "redirect",
"options": {
"mobileDefaultChoice": "DEFAULT",
"destinationProtocol": "SAME_AS_REQUEST",
"destinationHostname": "SAME_AS_REQUEST",
"destinationPath": "OTHER",
"destinationPathOther": "",
"queryString": "APPEND",
"responseCode": 302
}
}
]
Options
Option | Description |
---|---|
mobile_default_choice |
The mobile browser response. Value is one of:
|
destination_protocol |
Choose the protocol for the redirect URL. Value is one of:
|
destination_hostname |
Specify how to change the requested hostname, independently from the pathname. Value is one of:
|
destination_hostname_subdomain |
Specifies a subdomain to prepend to the current hostname. For example, a value of
m changes www.example.com to m.www.example.com .
|
destination_hostname_sibling |
Specifies the subdomain with which to replace to the current hostname's leftmost subdomain. For example, a value of
m changes www.example.com to m.example.com .
|
destination_hostname_other |
Specifies the full hostname with which to replace the current hostname.
|
destination_path |
Specify how to change the requested pathname, independently from the hostname. Value is one of:
|
destination_path_prefix |
When
destination_path is set to PREFIX_REQUEST this prepends the current path. For example, a value of /prefix/path changes /example/index.html to /prefix/path/example/index.html .
|
destination_path_suffix_status |
When
destination_path is set to PREFIX_REQUEST this gives you the option of adding a suffix. Value is one of:
|
destination_path_suffix |
When
destination_path is set to PREFIX_REQUEST this replaces the current path.
|
destination_path_other |
When
destination_path is set to PREFIX_REQUEST this replaces the current path.
|
query_string |
When set to
APPEND passes incoming query string parameters as part of the redirect URL. Otherwise set this to IGNORE .
|
response_code |
Specify the redirect's response code. Value is one of:
|
Updated about 1 hour ago