30 days free. No credit card. Full access from the moment you connect your site.

Start free trial

Create Rank Math Redirection

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

Abilityrank-math/create-redirection
ToolsetRank Math — toolset/rank-math
GroupRank Math › Redirections & 404s
RequiresRank Math SEO, active on the site
Capabilitymanage_options
SafetyWrites data
RepeatableNot idempotent — each call changes the row set, so re-running is not a no-op
Ships inAcrossAI 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

NameTypeRequiredWhat it is
sourcesarrayYesOne or more sources, each with a pattern and a comparison of exact, contains, start, end or regex.
destinationstringYesWhere to send matching requests.
status_codeintegerNo — defaults to 301The HTTP status to use.
statusstringNoWhether the rule is active.

What comes back

NameTypeWhat it is
redirectionobjectThe created rule.
forced_inactivebooleanWhether the loop guard saved it inactive.
successbooleanWhether the call completed.
messagestringA one-line summary of what happened, suitable for showing a human.
error_codestringPresent 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.
  • contains matches 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


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading