Digital Sovereignty for everyone

Abilities

Create Redirect

lh-url-redirects/create-redirect

Creates a network URL redirect or 410 Gone rule for a source URL on any host, mapped to a site or not. Rules apply only when the source would otherwise 404, or to the root of a domain no site is mapped to. Refuses a duplicate source (same match type, host and path) and a target equal to the source. Returns the saved rule. Requires install_plugins; main site only.

Parameter Type Required Default Description
source_url string Yes Absolute URL to match, e.g. https://example.org/old-page/. Only host and path count: scheme, query string and trailing slash are ignored. The host need not belong to any site on the network.
match_type string No exact (default) matches the path only; prefix matches the path and everything below it, and the path “/” matches the whole host. The longest prefix wins, and an exact rule beats any prefix. One of: exact, prefix.
status_code integer No Response code. Default 301. 410 sends Gone and ignores target_url. One of: 301, 302, 303, 307, 308, 410.
target_url string No Absolute http(s) URL to redirect to, on any domain. Required unless status_code is 410.
note string No Optional note on why the rule exists.
task_id integer No Optional. The lh-tasks task this call is working on. Pass with claim_token: the call is refused unless you hold that claim, and a successful call renews it.
claim_token string No Optional. The claim_token from claim-next-task for task_id. Required when task_id is given.

Delete Redirect

lh-url-redirects/delete-redirect Destructive Idempotent

Permanently deletes a network URL redirect or 410 rule by id, so its source 404s again. Returns the deleted rule so it can be recreated with create-redirect if needed. Requires install_plugins; main site only.

Parameter Type Required Default Description
id integer Yes
task_id integer No Optional. The lh-tasks task this call is working on. Pass with claim_token: the call is refused unless you hold that claim, and a successful call renews it.
claim_token string No Optional. The claim_token from claim-next-task for task_id. Required when task_id is given.

Get Redirect

lh-url-redirects/get-redirect Read-only Idempotent

Gets one network URL redirect or 410 rule by its id, with its hit count and last hit. Use list-redirects to find ids, or resolve-url to find the rule a URL would hit. Requires install_plugins; main site only.

Parameter Type Required Default Description
id integer Yes

Import Legacy Redirects

lh-url-redirects/import-legacy-redirects Idempotent

Imports the published rules of the retired lh-response-handler plugin into the network redirect table. Dry run by default: reports what each Response post would become without writing. Safe to rerun, since posts already imported are skipped by their legacy id, as are sources that duplicate an existing rule. The old posts are left untouched. Requires install_plugins; main site only.

Parameter Type Required Default Description
dry_run boolean No true true (default) only reports; false writes the rules.
task_id integer No Optional. The lh-tasks task this call is working on. Pass with claim_token: the call is refused unless you hold that claim, and a successful call renews it.
claim_token string No Optional. The claim_token from claim-next-task for task_id. Required when task_id is given.

List Redirects

lh-url-redirects/list-redirects Read-only Idempotent

Lists network URL redirect and 410 rules, filtered by host, site, status code or text. Returns rules sorted by host then path, with hit counts, plus the total matching. search matches path, target or note. site_id 0 lists rules for domains no site is mapped to. Pages with limit (max 500) and offset. Requires install_plugins; main site only.

Parameter Type Required Default Description
host string No Only rules for this host, e.g. princesparktouch.com.
site_id integer No Only rules whose source belongs to this network site; 0 for unmapped domains.
status_code integer No Only rules with this response code.
search string No Text to find in the source path, target URL or note.
limit integer No 100
offset integer No 0

Resolve URL

lh-url-redirects/resolve-url Read-only Idempotent

Shows which network redirect rule, if any, a URL would hit, without counting a hit. Applies the same matching as live requests: exact path first, then the longest prefix on that host. A rule only fires live when the URL would otherwise 404, which this does not check. Requires install_plugins; main site only.

Parameter Type Required Default Description
url string Yes Absolute URL to test.

Update Redirect

lh-url-redirects/update-redirect Idempotent

Changes an existing network URL redirect or 410 rule by id; fields left out keep their values. Hit counts are kept. Refuses a change that would duplicate another rule’s source. Returns the updated rule. Requires install_plugins; main site only.

Parameter Type Required Default Description
id integer Yes
source_url string No Absolute URL to match, e.g. https://example.org/old-page/. Only host and path count: scheme, query string and trailing slash are ignored. The host need not belong to any site on the network.
match_type string No exact (default) matches the path only; prefix matches the path and everything below it, and the path “/” matches the whole host. The longest prefix wins, and an exact rule beats any prefix. One of: exact, prefix.
status_code integer No Response code. Default 301. 410 sends Gone and ignores target_url. One of: 301, 302, 303, 307, 308, 410.
target_url string No Absolute http(s) URL to redirect to, on any domain. Required unless status_code is 410.
note string No Optional note on why the rule exists.
task_id integer No Optional. The lh-tasks task this call is working on. Pass with claim_token: the call is refused unless you hold that claim, and a successful call renews it.
claim_token string No Optional. The claim_token from claim-next-task for task_id. Required when task_id is given.

If you like this plugin please consider making a donation to further development

Install LHero.org

lhero.org

Open it straight from your home screen, full screen and quicker to load.

  1. Tap the Share button . If you cannot see it, tap ••• first.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add.
  1. Tap the browser menu â‹®.
  2. Tap Install app or Add to Home screen.
  1. In the menu bar, choose File, then Add to Dock.

Use your browser's menu to install this site or add it to your home screen.