CorefinityCorefinityDocs
Open the Control PanelControl Panel
Redirects · 5 of 5

Test an address against the redirects

Answers which rule matches an address and where it sends the visitor. Send rules to test an unsaved table instead of the saved one. Nothing is saved.

POST/api/corestack/sites/{site}/redirects/test

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

hoststring or null

Test as this domain. It must be one of the site's own. Up to 253 characters.

rulesarray of objects or null

An unsaved table to test instead of the saved one.

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
urlstringRequired

A path starting with /, or a full http:// or https:// address. Up to 4,096 characters.

Returns

200 What the table answers for the address.

Fields of the 200 answer
chainarray of objectsRequired

Each redirect the address goes through.

Fields of each item
fromstring
statusinteger
tostring
codeinteger or nullRequired
disabled_matchinteger

The id of a disabled rule that would have matched. Sent only when there is one.

hoststring or nullRequired
matched_ruleobject or any or nullRequired
pathstringRequired
querystring or nullRequired
targetstring or nullRequired

Where the visitor is sent. Null when no rule matches.

tried_beforearray of integers or nullRequired

The ids of the rules tried before the answer.

typestring or nullRequired
urlstringRequired
warningsarray of stringsRequired

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.
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.
409provisioningThe site is still being created. Try again in a few minutes.
422invalidFix the field named in field; errors says why.
429rate_limitedWait for the seconds in Retry-After.

Reasons are listed by name in Errors and refusals.

The same task elsewhere

curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/redirects/test \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "/services/web-design/ecommerce?ref=footer"
  }'
{
  "chain": [
    {
      "from": "/services/web-design/ecommerce?ref=footer",
      "status": 301,
      "to": "/services/websites/ecommerce?ref=footer"
    }
  ],
  "code": 301,
  "host": "www.harbourandfinch.example.com",
  "matched_rule": {
    "enabled": true,
    "from": "/services/web-design",
    "hosts": null,
    "id": 46,
    "keep_query": true,
    "note": null,
    "position": 6,
    "shadowed_by": null,
    "status": 301,
    "to": "/services/websites",
    "type": "prefix"
  },
  "path": "/services/web-design/ecommerce",
  "query": "ref=footer",
  "target": "/services/websites/ecommerce?ref=footer",
  "tried_before": [
    41,
    44,
    45
  ],
  "type": "prefix",
  "url": "https://www.harbourandfinch.example.com/services/web-design/ecommerce?ref=footer",
  "warnings": []
}
Try it
Held in this tab's memory only. Never stored or sent to us.

This sends a real POST request and changes your account.

Use a token with only the read scope. How to make one

Was this helpful?
Open in ClaudeOpen in ChatGPT