---
title: "corestack_redirects_update"
url: https://docs.corefinity.com/mcp/tools/corestack_redirects_update
type: tool
last_updated: 2026-11-13
feature: redirects
related:
  - https://docs.corefinity.com/api/reference/site-settings/replace-site-redirects.md
  - https://docs.corefinity.com/guides/sites/site-settings/redirects.md
---
# corestack_redirects_update

**Change redirects.** Replace a row's whole redirect table: send every rule you want to keep, in the order they should be tried — rules left out are removed — with the version corestack_redirects_get answered. 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; prefix and regex rules are then tried in order. Rules limited to a domain run before the every-domain rules. Scope: write. Long-running: answers with a task.

- Scope: `write`
- Runs as a task: yes

## When to use it

Replace a row's whole redirect table: send every rule you want to keep, in the order they should be tried — rules left out are removed — with the version corestack_redirects_get answered. 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; prefix and regex rules are then tried in order. Rules limited to a domain run before the every-domain rules.

## Inputs

- `site_id` (integer, ≥ 1, required)
- `version` (integer, ≥ 0, required): The table's version from corestack_redirects_get.
- `rules` (array of objects, up to 2000 items, required)
  - `id` (integer, or null, ≥ 1): An existing rule's id; leave it out (or null) for a new rule.
  - `type` (one of `exact`, `prefix`, `regex`, required)
  - `from` (string, up to 2000 characters, required)
  - `to` (string, up to 2000 characters, required)
  - `status` (one of `301`, `302`, required)
  - `keep_query` (boolean, required)
  - `enabled` (boolean, required)
  - `note` (string, or null, up to 120 characters)
  - `hosts` (array of strings, at least 1, or null): Limit the rule to some of the row's own domains (corestack_redirects_get's `available_hosts`); null runs it on every domain. Left out on a saved rule, the rule keeps the domains it has. On its domains a limited rule runs before the every-domain rules, and never on the platform's reserved paths.

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "rules": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "from": {
            "maxLength": 2000,
            "type": "string"
          },
          "hosts": {
            "description": "CPPB-1170: limit the rule to some of the row's own domains (corestack_redirects_get's available_hosts); null runs it on every domain. Left out on a saved rule, the rule keeps the domains it has. On its domains a limited rule runs before the every-domain rules, and never on the platform's reserved paths.",
            "items": {
              "maxLength": 253,
              "type": "string"
            },
            "minItems": 1,
            "type": [
              "array",
              "null"
            ]
          },
          "id": {
            "description": "An existing rule's id; leave it out (or null) for a new rule.",
            "minimum": 1,
            "type": [
              "integer",
              "null"
            ]
          },
          "keep_query": {
            "type": "boolean"
          },
          "note": {
            "maxLength": 120,
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "enum": [
              301,
              302
            ],
            "type": "integer"
          },
          "to": {
            "maxLength": 2000,
            "type": "string"
          },
          "type": {
            "enum": [
              "exact",
              "prefix",
              "regex"
            ],
            "type": "string"
          }
        },
        "required": [
          "type",
          "from",
          "to",
          "status",
          "keep_query",
          "enabled"
        ],
        "type": "object"
      },
      "maxItems": 2000,
      "type": "array"
    },
    "site_id": {
      "minimum": 1,
      "type": "integer"
    },
    "version": {
      "description": "The table's version from corestack_redirects_get.",
      "minimum": 0,
      "type": "integer"
    }
  },
  "required": [
    "site_id",
    "version",
    "rules"
  ],
  "type": "object"
}
```

## Refusals

- `stale`: the object changed since you read it; read it again and call with the new version.
- `invalid_arguments` on `rules.<i>.from`, "… is already an exact location in your nginx rules (line N)" (or "in your path apps"): an exact or prefix rule on every domain adds `location = <from>`, and nginx refuses a second exact location for one path. Change the rule, or remove that location with corestack_nginx_rules_update first. A prefix location (`location /old`), a regex location and a rule limited to some domains never collide.
- `invalid_arguments` on `rules.<i>.from`, "… is reserved by the platform": a rule limited to some domains cannot start on a path the platform answers itself, such as its health and maintenance pages, the PHP entry points, and on WordPress any PHP-type file under an uploads folder (`wp-content/uploads`, `wp-content/blogs.dir`, Bedrock's `app/uploads`). Pick another path.
- `work_failed`: the task's operation or deployment ended failed; `details` carries the record; read `details`; the person may retry with `corestack_operation_retry` where it applies.
- `managed_elsewhere` (message: "This site is managed by another control panel"): another control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).

## Example

```json
{
  "name": "corestack_redirects_update",
  "arguments": {
    "site_id": 4211,
    "version": 3,
    "rules": [
      {
        "type": "exact",
        "from": "/old-page",
        "to": "/new-page",
        "status": 301,
        "keep_query": true,
        "enabled": true
      }
    ]
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_redirects_update with site_id 4211, version 3, rules [{"type":"exact","from":"/old-page","to":"/new-page","status":301,"keep_query":true,"enabled":true}]. (Change redirects.) Tell me what it returned.
```

## The same task elsewhere

- Endpoint: [PUT /api/corestack/sites/{site}/redirects](https://docs.corefinity.com/api/reference/site-settings/replace-site-redirects.md)
- Guide: [Redirects](https://docs.corefinity.com/guides/sites/site-settings/redirects.md)
