Redirection
New in 3.21.1 (free), and in EMCP Lite 1.0.5 on WordPress.org. Two dispatcher tools work with Redirection 5.10.1:
| Tool | Default | Purpose |
|---|---|---|
redirection-read | On | Status, redirects, groups, the redirect log and the 404 log (7 operations) |
redirection-write | Off | Create, edit, enable, disable and delete exact URL redirects; create and rename groups (7 operations) |
Enable the write tool under Tools > Plugins > Redirection. Call a tool with no operation to get the operations the connected user may run, with their argument schemas.
Redirection is a separate plugin from EMCP’s own Redirect Manager. These tools manage the Redirection plugin’s redirects and groups.
Requirements
Section titled “Requirements”- Redirection 5.10.1 exactly, with its database setup finished in Redirection’s own screen. Another version answers
unsupported_version; missing tables answersetup_required. - An administrator (
manage_options). Each operation also checks Redirection’s own capability:redirect_manage,group_manage,log_manageand404_managefor reads,redirect_add,redirect_deleteandgroup_addfor writes.
Read operations
Section titled “Read operations”| Operation | What it does |
|---|---|
status | Redirection version, the qualified version and the module writes use (WordPress) |
list-redirects | Redirects, paged (page, per_page 5 to 100), filtered by search (URL) or group_id |
get-redirect | One redirect by id, with its version |
list-groups | Groups, paged, filtered by search (name) |
get-group | One group by id, with its version |
list-logs | The redirect log, paged and searchable by URL |
list-404s | The 404 log, paged and searchable by URL |
Both logs leave out IP addresses, user agents, referrers, HTTP headers and request data.
Write operations
Section titled “Write operations”Every write needs confirm: true. dry_run: true validates without writing. Existing records need the version from get-redirect or get-group.
| Operation | What it does |
|---|---|
create-redirect | source, target, group_id, optional title and code (301, 302, 303, 307 or 308; 302 when omitted) |
update-redirect | Change the source, target, title or code of an exact URL redirect |
enable-redirect | Turn a redirect on |
disable-redirect | Turn a redirect off |
delete-redirect | Delete a redirect (irreversible) |
create-group | A new group in the WordPress module, name up to 50 characters of plain text (irreversible) |
rename-group | Rename a WordPress-module group |
Rules and refusals
Section titled “Rules and refusals”- Exact URL redirects only. A redirect with another match type, another action or a regex is readable but refused for writes (
unsupported_redirect). - WordPress-module groups only. Apache and Nginx groups are written to server files by Redirection, so they are refused (
linked_unavailable,unsupported_module). - URLs. The source must be a path on this site starting with
/, without a fragment. The target is a local path or an HTTP(S) URL without credentials. Control characters and backslashes are refused (invalid_url). - Loops. A create, update or enable that would loop through other enabled redirects on this site is refused (
redirect_cycle). No request is ever made to a target. - Versions. A redirect’s version covers the redirect and its group; a group’s version covers every redirect in it. A change since your read answers
conflict. Hit counts and last access times are not part of a version. - One change at a time. A second Redirection write while one runs answers
redirection_busy. - If Redirection fails halfway, EMCP puts the previous state back (
native_error_recovered) or records a recovery entry in History (partial_write). A new redirect whose ID cannot be attributed is never replayed.
History
Section titled “History”Creates, edits, enables, disables and renames can be undone from History: a new redirect is removed, an edit restores the earlier source, target, title, code and enabled state. Undo takes the same lock, refuses a newer change unless forced, and checks the group and loops again. Deleting a redirect and creating a group are recorded as irreversible. Hit counters are never restored.
