rank-math/create-redirection creates a redirection with one or more source rules. Each source needs a pattern and a comparison: exact, contains, start, end or regex.
Calling it twice creates two rules, so check with rank-math/find-redirection first.
At a glance
| Ability | rank-math/create-redirection |
| Toolset | Rank Math — toolset/rank-math |
| Group | Rank Math › Redirections & 404s |
| Requires | Rank Math SEO, active on the site |
| Capability | manage_options |
| Safety | Writes data |
| Repeatable | Not idempotent — each call changes the row set, so re-running is not a no-op |
| Ships in | AcrossAI Abilities Manager 0.0.34 and later |
The loop guard, and why the response mentions it
Rank Math checks whether a source would resolve to its own destination, because a redirection that points at itself is an infinite loop and the browser gives up with an error rather than a page.
When it detects one, Rank Math still saves the rule — it just forces it inactive. From a caller’s point of view that is a successful creation of something that does not work, and the only visible difference is a status field nobody thought to check.
So the response says so explicitly. A rule that was saved inactive because of the loop guard is reported as such rather than as a plain success.
The comparison mode is the decision that matters most. exact is predictable and narrow; contains catches far more than people expect — a rule for /news also catches /company/newsletter; regex is precise and easy to get wrong in ways that only show up on URLs nobody tested.
Not idempotent. Two calls make two rules, and two rules matching the same URL is exactly the situation that makes redirections hard to reason about later.
Input
| Name | Type | Required | What it is |
|---|---|---|---|
sources | array | Yes | One or more sources, each with a pattern and a comparison of exact, contains, start, end or regex. |
destination | string | Yes | Where to send matching requests. |
status_code | integer | No — defaults to 301 | The HTTP status to use. |
status | string | No | Whether the rule is active. |
What comes back
| Name | Type | What it is |
|---|---|---|
redirection | object | The created rule. |
forced_inactive | boolean | Whether the loop guard saved it inactive. |
success | boolean | Whether the call completed. |
message | string | A one-line summary of what happened, suitable for showing a human. |
error_code | string | Present only on failure — a stable machine-readable reason, such as a missing field, a wrong field type or an unmet confirmation. |
Example
Ask your assistant:
Redirect /old-pricing to /pricing.
It resolves to one call:
{
"ability": "rank-math/create-redirection",
"parameters": {
"sources": [{ "pattern": "/old-pricing", "comparison": "exact" }],
"destination": "/pricing",
"status_code": 301
}
}Worth knowing
- Check
forced_inactive. A loop-guarded rule is saved and does nothing. containsmatches much more than people expect.- Not idempotent — two calls, two rules.
- 301 is permanent and cached by browsers. Use 302 while you are unsure.
Related abilities
- Find Rank Math Redirection — check for an existing rule first
- Update Rank Math Redirection — edit rather than recreate
- List Rank Math 404 Logs — find what needs redirecting
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category