create_redirect
Create a redirect rule from old paths, prefixes, or URLs to new pages or URLs, preventing broken links with permanent, temporary, or gone status codes.
Instructions
Create a redirect rule. source: a path ("/old-page"), a prefix ("/blog/*" — the rest of the path is carried over) or a full URL on the old site (reduced to its path). Target: EITHER targetDocumentId (+ optional targetLocale) to follow a page wherever it moves, OR target = a path or https:// URL — a path that names a published page is stored as that page. status: 301 (default, permanent — passes link equity), 302/307 temporary, 308 permanent, 410 gone (no target). A target that is itself redirected is collapsed to the final destination; loops are refused. Publishing a new slug or moving a page creates 301s automatically — check list_redirects before adding one by hand.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | Free-text note for editors, e.g. 'old WordPress URL'. | |
| site | No | Site slug or id to act in (multisite). Omit to use this server's default site. Call list_sites to see what exists — an empty tree or search usually means the wrong site, not missing content. | |
| source | Yes | Old path ('/old-page'), prefix ('/blog/*') or full URL on the old site. | |
| status | No | 301 permanent (default), 302/307 temporary, 308 permanent, 410 gone (no target). | |
| target | No | Destination path or https:// URL. Use this OR targetDocumentId. | |
| keepQuery | No | Carry the request's query string over to the target. | |
| targetLocale | No | Locale of targetDocumentId to send visitors to. Omit for the site default. | |
| targetDocumentId | No | documentId of the destination page; the rule follows it if it moves. Use this OR target. |