Create Redirect

A page moves, a product is retired, a URL changes — and the old address starts returning 404s for visitors and search engines.

redirects/create-redirect points that old URL wherever you want, through the Redirection plugin’s own model — so the redirect’s URL matching, flags and cache flush all run and it actually fires.

At a glance

Abilityredirects/create-redirect
ToolsetRedirection — toolset/redirection
GroupRedirection
RequiresRedirection, active on the site
Capabilitymanage_options
SafetyWrites data
RepeatableNot idempotent — calling it twice creates two redirects
Ships inAcrossAI Abilities Manager 0.0.43 and later

How it works

Pass a source URL and what to do with it. The common case is a permanent redirect: action_type url with action_code 301 and a target.

It also supports 302, 307 and 308 redirects, an error action that returns 404 or 410 with no target, pass to serve the target without changing the URL, random to a random post, and nothing to only log. Leave match_type as url for the common case, or set regex true for a pattern source.

The action type and HTTP code must agree — a redirect needs a 3xx code and a target; an error needs a 4xx/5xx code and no target — and the combination is checked before anything is written.

Input

NameTypeRequiredWhat it is
sourcestringYesThe source URL or path to match, e.g. /old-page.
targetstringNoWhere to send the request. Required for url and pass actions.
action_typestringNourl (redirect), error, pass, random or nothing. Default url.
action_codeintegerNoHTTP status. Defaults to 301 for a url action, 410 for an error action.
match_typestringNoHow to match the request. Default url.
group_idintegerNoGroup to place it in. Defaults to the last-used group.
regexbooleanNoTreat the source as a regular expression.
titlestringNoOptional human label.

What comes back

NameTypeWhat it is
idintegerThe new redirect’s id.
redirectobjectThe created redirect: source, target, code, group, match and action type, enabled state.
successbooleanWhether the call completed.
messagestringA one-line summary suitable for showing a human.
error_codestringPresent only on failure — a stable machine-readable reason, such as a mismatched action and code.

Example

Ask your assistant:

Redirect /old-pricing to /pricing permanently.

It resolves to one call:

{
  "ability": "redirects/create-redirect",
  "parameters": {
    "source": "/old-pricing",
    "target": "/pricing",
    "action_code": 301
  }
}

Worth knowing

  • Not idempotent — calling it twice creates two redirects. Check first with List Redirects.
  • The redirect is created through Redirection’s own model, so a raw database write that would store a redirect that never fires is never used.
  • Needs the Redirection plugin active; without it you get a clear “not active” message rather than an error.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading