CorefinityCorefinityDocs
Open the Control PanelControl Panel
Redirects · 2 of 5

Replace a site's redirects

Replaces the whole table: send the version from the last read and every rule to keep, in the order they should be tried. A rule left out is removed.

PUT/api/corestack/sites/{site}/redirects

Path parameters

siteintegerRequired

The id of a site row. A website's production site and each of its environments has its own id. Digits only. At least 1.

Body

rulesarray of objectsRequired

Every rule to keep, in the order they are tried. At most 2,000 rules, of which at most 500 are prefix or regex rules.

Fields of each item
enabledboolean

Defaults to true.

fromstringRequired

The path to redirect, without a query string. For a regex rule, the pattern, at most 256 bytes. Up to 2,000 characters.

hostsarray of strings or null

Limit the rule to some of the site's own domains. Null or left out on a new rule means every domain; left out on a saved rule keeps what it has.

idinteger or null

A saved rule's id, to keep it. Leave it out, or send null, for a new rule. At least 1.

keep_queryboolean

Whether the request's query string is carried over to the target. Send false when the target has a query string of its own. Defaults to true.

notestring or null

Up to 120 characters.

statusinteger

Defaults to 301.

301302
tostringRequired

A path or an https:// address. A regex rule may use $1 to $9. A target with a query string of its own is taken only with keep_query sent as false, and never on a prefix rule, where the rest of the path is added at its end. The limit is 2,000 bytes of the target as it is stored, not 2,000 characters as sent. The host is written in lower case and each character outside ASCII is percent-encoded, so é counts as six bytes (%C3%A9).

typestringRequired
exactprefixregex
versionintegerRequired

The version of the last read. A save with an older version is refused 409 stale. At least 0.

Returns

200 The table sent is the table the site already has. Nothing was started and operation is null.

201 The table was saved and is being applied. Follow operation.id until it completes.

Fields of the 200 answer
operationobject or any or nullRequired

The change that applies the table. Null when the table sent is the one the site already has.

redirectsobjectRequired
Fields
applyobjectRequired

Whether a saved set of rules is live on the site.

Fields
applied_atstring or nullRequired
detailany

Sent only by the sets that have more to say, such as HTTP authentication.

errorstring or nullRequired
operationobject or any or nullRequired

The change that is applying the set, while one is running.

statestringRequired

Such as applied or applying.

state_labelstringRequired
available_hostsarray of objectsRequired

The domains a rule can be limited to.

Fields of each item
hoststringRequired
rolestringRequired

The domain's role, such as primary or alias.

formatsarray of stringsRequired

The formats import and export take.

host_scopingbooleanRequired

Whether a rule can be limited to some domains at the moment.

hostsarray of stringsRequired

The domains the site answers on.

limitsobjectRequired
Fields
from_maxintegerRequired
import_max_bytesintegerRequired
regex_maxintegerRequired
rules_maxintegerRequired
to_maxintegerRequired
rulesarray of objectsRequired
Fields of each item
enabledbooleanRequired
fromstringRequired
hostsarray of strings or nullRequired

The domains the rule is limited to. Null for every domain.

idinteger or nullRequired

The rule's id. Null for a rule that is not saved yet, as in an import or a test of unsaved rules.

keep_querybooleanRequired
notestring or nullRequired
positionintegerRequired

The rule's place in the table, starting at 1. A rule whose path is the address asked for (an exact rule, or a prefix rule's own path) is taken first, whatever its position. Otherwise prefix and regex rules are tried in this order, and the first match wins. On a domain, the rules limited to it are taken this way before the rules for every domain.

shadowed_byinteger or nullRequired

The id of an earlier rule that always answers first, so this one never matches.

statusintegerRequired
301302
tostringRequired
typestringRequired
exactprefixregex
versionintegerRequired
Fields of the 201 answer
operationobject or any or nullRequired

The change that applies the table. Null when the table sent is the one the site already has.

redirectsobjectRequired
Fields
applyobjectRequired

Whether a saved set of rules is live on the site.

Fields
applied_atstring or nullRequired
detailany

Sent only by the sets that have more to say, such as HTTP authentication.

errorstring or nullRequired
operationobject or any or nullRequired

The change that is applying the set, while one is running.

statestringRequired

Such as applied or applying.

state_labelstringRequired
available_hostsarray of objectsRequired

The domains a rule can be limited to.

Fields of each item
hoststringRequired
rolestringRequired

The domain's role, such as primary or alias.

formatsarray of stringsRequired

The formats import and export take.

host_scopingbooleanRequired

Whether a rule can be limited to some domains at the moment.

hostsarray of stringsRequired

The domains the site answers on.

limitsobjectRequired
Fields
from_maxintegerRequired
import_max_bytesintegerRequired
regex_maxintegerRequired
rules_maxintegerRequired
to_maxintegerRequired
rulesarray of objectsRequired
Fields of each item
enabledbooleanRequired
fromstringRequired
hostsarray of strings or nullRequired

The domains the rule is limited to. Null for every domain.

idinteger or nullRequired

The rule's id. Null for a rule that is not saved yet, as in an import or a test of unsaved rules.

keep_querybooleanRequired
notestring or nullRequired
positionintegerRequired

The rule's place in the table, starting at 1. A rule whose path is the address asked for (an exact rule, or a prefix rule's own path) is taken first, whatever its position. Otherwise prefix and regex rules are tried in this order, and the first match wins. On a domain, the rules limited to it are taken this way before the rules for every domain.

shadowed_byinteger or nullRequired

The id of an earlier rule that always answers first, so this one never matches.

statusintegerRequired
301302
tostringRequired
typestringRequired
exactprefixregex
versionintegerRequired

If it is refused

StatusReasonWhat to do
401noneSend a valid token as Authorization: Bearer <token>.
403company_unavailableYour company is unavailable.
403scope_requiredUse a token with the scope named in scope.
403two_factor_requiredTurn on two-factor on your account, then send again.
404feature_offThis feature is not on for your organisation yet.
409busyAnother operation is running on the site. Wait for it to finish.
409cluster_pausedChanges on this site are paused for planned maintenance; please try again later.
409conflictThe action conflicts with the object's present state. Read the message.
409deletedThe site, environment or copy has been deleted, or is being deleted. Nothing can be changed on it. Restore a deleted site first if it can still be restored.
409managed_elsewhereThis site is read-only here. Change it in the control panel that manages it.
409provisioningThe site is still being created. Try again in a few minutes.
409removedThe site or environment is being removed, or has been. Nothing can be changed on it.
409restore_runningA restore is running on the site. Wait for it to finish, then try again.
409staleWhat you read has changed since you read it. Read it again, then send the change with its new version or quote.
422invalidFix the field named in field; errors says why.
429rate_limitedWait for the seconds in Retry-After.
502noneRead the message; it says what happened.

Reasons are listed by name in Errors and refusals.

The same task elsewhere

curl -X PUT https://manage.corefinity.com/api/corestack/sites/1042/redirects \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "rules": [
      {
        "enabled": true,
        "from": "/about-us.html",
        "id": 41,
        "keep_query": true,
        "note": "Old brochure page",
        "status": 301,
        "to": "/about",
        "type": "exact"
      },
      {
        "enabled": true,
        "from": "/blog",
        "hosts": [
          "www.harbourandfinch.example.com"
        ],
        "keep_query": true,
        "status": 301,
        "to": "/news",
        "type": "prefix"
      }
    ],
    "version": 12
  }'
{
  "operation": null,
  "redirects": {
    "apply": {
      "applied_at": "2026-11-02T15:41:09Z",
      "error": null,
      "operation": null,
      "state": "applied",
      "state_label": "Applied"
    },
    "available_hosts": [
      {
        "host": "harbourandfinch.example.com",
        "role": "primary"
      },
      {
        "host": "www.harbourandfinch.example.com",
        "role": "alias"
      }
    ],
    "formats": [
      "nginx",
      "apache",
      "csv"
    ],
    "host_scoping": true,
    "hosts": [
      "harbourandfinch.example.com",
      "www.harbourandfinch.example.com"
    ],
    "limits": {
      "from_max": 2000,
      "import_max_bytes": 524288,
      "regex_max": 256,
      "rules_max": 2000,
      "to_max": 2000
    },
    "rules": [],
    "version": 12
  }
}
Try it

Try it is off for this endpointIt overwrites data that cannot be brought back. Copy the request and run it yourself when you are sure.

Was this helpful?
Open in ClaudeOpen in ChatGPT