JSON Import/Export

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 – WordPress
  • 2 – Apache
  • 3 – Nginx

Redirect

The main data in a redirect is:

  • url – the source URL
  • match_data – the flags used when matching the source URL
  • action_code – the HTTP code used
  • action_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 URL
  • match_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 ID
  • title – optional title for the redirect
  • hits – number of times this redirect has been hit
  • regex – deprecated regular expression option. Use match_data instead
  • group_id – ID of the group this redirect belongs to
  • position – position within the list of redirects
  • last_access – date when the redirect was last hit
search previous next tag category expand menu location phone mail time cart zoom edit close