mod_redirect
Introduction
mod_redirect redirects HTTP requests based on defined rules.
Module Configuration
Description
conf/mod_redirect/mod_redirect.conf
Config Item | Description |
---|---|
Basic.DataPath | String Path of rule configuration |
Example
[Basic]
DataPath = mod_redirect/redirect.data
Rule Configuration
Description
conf/mod_redirect/redirect.data
Config Item | Description |
---|---|
Version | String Version of config file |
Config | Struct Redirect rules for each product. |
Config{k} | String Product name |
Config{v} | Object A ordered list of redirect rules |
Config{v}[] | Object A redirect rule |
Config{v}[].Cond | String Condition expression, See Condition |
Config{v}[].Actions | Object A ordered list of redirect actions |
Config{v}[].Actions[] | Object A redirect action |
Config{v}[].Actions[].Cmd | Object Name of redirect action |
Config{v}[].Actions[].Params | Object Parameters of redirect action |
Config{v}[].Status | Integer Status code |
Actions
Action | Description |
---|---|
URL_SET | Redirect to specified URL |
URL_FROM_QUERY | Redirect to URL parsed from specified query in request |
URL_PREFIX_ADD | Redirect to URL concatenated by specified prefix and the original URL |
SCHEME_SET | Redirect to the original URL but with scheme changed. supported scheme: http|https |
Example
{
"Version": "20190101000000",
"Config": {
"example_product": [
{
"Cond": "req_path_prefix_in(\"/redirect\", false)",
"Actions": [
{
"Cmd": "URL_SET",
"Params": ["https://example.org"]
}
],
"Status": 301
}
]
}
}