add_redirect
Add a redirect rule to a site to forward a moved or renamed page to its new path, with an optional 301/302 status and ordering position. Check results with test_redirect.
Instructions
Add one user redirect rule to a site, such as forwarding a moved page to its new path. User rules are checked before the live deploy's _redirects, in list order: the rule goes at the end of the user rules, or at position. The status defaults to 301, a permanent move. It is added to the latest list, without a version. Returns the rule with its id, and the new version. Visitors get it within about 5 minutes; check it with test_redirect. Each call is a separate save, so for more than a few rules use set_redirects or edit_redirects. Redirects apply only on the organization's own custom domains (CustomDomainRequired otherwise).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"siteId": "<siteId>",
"from": "<from>",
"to": "<to>"
},
"name": "add_redirect"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Destination: a path starting with `/`, or an http(s) URL. `:splat` fills in what `*` matched, and `:name` a placeholder's value. The request's query string is carried over. | |
| from | Yes | Source path: exact (`/old-page`), with `:name` placeholders (`/blog/:year/:slug`), or ending in `/*` (`/docs/*`). No query string. | |
| siteId | Yes | The site ID (from `list_sites`). | |
| status | No | 301, 302, 303, 307 or 308. Defaults to 301, a permanent move. Use 302 or 307 for a temporary one. | |
| position | No | Where to add the rule among the user rules, from 0. Defaults to the end. | |
| partition | No | Data partition the site lives in. Omit to use the user's home partition. |