Contents
On this page

Create Redirect - Plugixa Permalink Manager

POST /plugixa-permalink-manager/v1/redirects

Add a manual redirect from any old address to a path on this site or an allowed external URL.

Needs Plugixa Permalink Manager Pro and the plugixa_permalink_manager_redirects capability.

Request

POST https://your-site.example/wp-json/plugixa-permalink-manager/v1/redirects

Request body

Content type: application/json

Field Type Required Description
source string Yes The old address. Kept as typed, not turned into a slug: old-page.html stays old-page.html. Outer slashes, query string and fragment are dropped.
target string Yes Where it leads. A target starting with / is a path on this site. Anything else must be a full http or https URL on an allowed host: this site, a host listed in external_redirect_hosts, or any host when external_redirect_policy is any. See Redirects settings.
status_code integer No 301, 302, 307 or 308. Defaults to 301.
note string No Plain text, for you.

Note. A status_code that is not one of the four is saved as 301, without an error.

{
  "source": "/summer-sale.html",
  "target": "/shop/sale",
  "status_code": 301,
  "note": "Old campaign page"
}

Responses

201 Created. data is the new redirect.

{
  "success": true,
  "data": {
    "id": 112,
    "kind": "manual",
    "source_uri": "summer-sale.html",
    "target": {
      "url": "https://your-site.example/shop/sale",
      "title": null,
      "edit_url": null
    },
    "status_code": 301,
    "is_enabled": true,
    "note": "Old campaign page",
    "created_at": "2026-11-12 09:30:00"
  }
}
Field Type Meaning
data.id integer The redirect id
data.kind string auto (kept when an address changed), alias (an extra old address of an item), external (an item that lives at a fixed URL elsewhere) or manual
data.source_uri string The address it leaves from, without outer slashes
data.target.url string|null Where it leads. For auto and alias, the item’s current link
data.target.title string|null The item it leads to, null for a manual redirect
data.target.edit_url string|null The item’s edit screen, when you may edit it
data.status_code integer 301, 302, 307 or 308
data.is_enabled boolean Whether it is served
data.note string Your note
data.created_at string UTC datetime

Errors

Status Code When
409 plugixa_permalink_manager_redirect_exists A redirect from that address already exists. data.id is its id.
409 plugixa_permalink_manager_source_live The source is the address of a page that exists, so the redirect would never be used.
422 plugixa_permalink_manager_reserved_uri The source starts with a name WordPress needs, such as wp-admin.
422 plugixa_permalink_manager_invalid_uri The source contains a . or .. segment.
422 plugixa_permalink_manager_empty_uri The source is empty.
422 plugixa_permalink_manager_uri_too_long The source is longer than 2,000 characters.
422 plugixa_permalink_manager_invalid_target The target is empty.
422 plugixa_permalink_manager_redirect_loop The target is the source.
422 plugixa_permalink_manager_redirect_host The target is not a full http or https URL, contains forbidden characters, or its host is not allowed.
500 plugixa_permalink_manager_db_error The redirect could not be saved.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-permalink-manager/v1/redirects" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"source":"/summer-sale.html","target":"/shop/sale","status_code":301,"note":"Old campaign page"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-permalink-manager/v1/redirects');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'source'      => '/summer-sale.html',
        'target'      => '/shop/sale',
        'status_code' => 301,
        'note'        => 'Old campaign page',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`);
const response = await fetch('https://your-site.example/wp-json/plugixa-permalink-manager/v1/redirects', {
  method: 'POST',
  headers: {
    'Authorization': auth,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    source: '/summer-sale.html',
    target: '/shop/sale',
    status_code: 301,
    note: 'Old campaign page',
  }),
});
const { data } = await response.json();

Quick Links

Share