Redirection can import and export data in the following JSON format. This is a JSON object that contains an array of groups and redirects.
Note that importing from JSON may not use the same IDs.
{
"groups": [
{
"id": 1,
"name": "Redirections",
"redirects": 0,
"module_id": 1,
"enabled": true
}
],
"redirects": [
{
"id": 1,
"url": "/source",
"match_url": "/source",
"match_data": {
"source": {
"flag_query": "exact",
"flag_case": false,
"flag_trailing": false,
"flag_regex": false
}
},
"action_code": 301,
"action_type": "url",
"action_data": {
"url": "/target"
},
"match_type": "url",
"title": "",
"hits": 15,
"regex": false,
"group_id": 9,
"position": 0,
"last_access": "May 18, 2019",
"enabled": true
}
]
}
Redirect Group
A group contains the group name and module type. The type is defined by module_id and can be:
1– WordPress2– Apache3– Nginx
Redirect
The main required data in a redirect is:
url– the source URLmatch_data– the flags used when matching the source URLaction_code– the HTTP code usedaction_type– the type of action performed when redirecting (url,error,nothing,pass)action_data– the data used by the action_type. Typically contains the target URLmatch_type– the type of match performed (url,server,ip,referrer,useragent)enabled– whether the redirect is enabled or not
It also contains other information:
id– database IDtitle– optional title for the redirecthits– number of times this redirect has been hitregex– deprecated regular expression option. Use match_data insteadgroup_id– ID of the group this redirect belongs toposition– position within the list of redirectslast_access– date when the redirect was last hit