=== Subset Redirects ===
Contributors: functionform
Tags: redirect, 301, 404, redirection, seo
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 0.8.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Fast redirects and a 404 log that won't bloat your database. No ads, no nags.

== Description ==

Subset Redirects manages redirects and logs 404s, built for developers, agencies and theme owners.

* **Fast.** Redirects live in their own indexed table and are checked early in the request. A site with no redirects runs no extra queries at all.
* **Quiet.** No ads, upsells or nag notices. Problems show up in Site Health, not as admin notices.
* **Extensible.** Hooks and filters for everything that matters, plus WP-CLI commands and a REST API.
* **Safe to remove.** Uninstalling keeps your redirects unless you choose otherwise.

= Redirects =

* 301 (permanent), 302 (temporary) and 410 (gone) redirects, to a page on your site or, when you allow it, to another site.
* Choose whether the query string must match exactly, is ignored, or is passed through to the target.
* Loops are refused when you save, and chains are pointed out, with a tester that shows what any URL does.
* Groups, notes, hit counts, and search, filtering and bulk actions in the list.

= Automatic redirects =

When you change a published post's or page's slug or parent, or a category's or tag's slug, a redirect from the old URL is added for you, including for child pages. Choose which post types and taxonomies to watch, and optionally send a 410 for trashed posts.

= 404 log =

See which missing URLs visitors actually hit, how often and from where, and turn one into a redirect in a click. The log is built not to grow without limit: scanners and common probe paths are ignored, new URLs are rate-limited, repeat visits only bump a counter, and old entries are pruned daily. It stores no IP addresses.

= Import and export =

* Import and export CSV files, with a preview before anything is saved.
* Import from Redirection, Yoast SEO Premium and Rank Math.

= For developers =

* WP-CLI: `wp subset redirector redirect add|update|list|test|import|export|…` `wp subset redirector 404 list|ignore|resolve|reopen|delete|clear|prune`, `wp subset redirector 404 ignore-patterns list|add|remove` and `wp subset redirector settings list|get|set|reset`.
* REST API under `subset-redirect/v1`.
* Hooks for every step, documented with examples in the plugin's repository.
* Multisite: each site keeps its own redirects, and network activation sets up every site.
* Page caches (WP Rocket, LiteSpeed Cache, W3 Total Cache, WP Super Cache, SiteGround Optimizer) are purged for a redirect's URL when it's saved.

== Installation ==

1. Upload the plugin to `/wp-content/plugins/`, or install it from the Plugins screen.
2. Activate it.
3. Go to Subset > Redirects to add redirects, see the 404 log, import and change settings.

== Frequently Asked Questions ==

= Will deleting the plugin delete my redirects? =

No. Deleting the plugin keeps your redirects, 404 log and settings, so reinstalling it picks up where you left off. To remove everything when the plugin is deleted, turn on "Delete all data on uninstall" under Subset > Redirects > Settings first. On multisite, each site decides for itself.

= Can I bring my redirects from another plugin? =

Yes, from Redirection, Yoast SEO Premium and Rank Math: go to Subset > Redirects > Import & Export, or run `wp subset redirector redirect import-from <plugin>`. Their data is read straight from the database, so the other plugin doesn't have to be active. You see what will happen before anything is saved. Redirects that already exist are skipped, ones that clash with an existing redirect are reported and left alone, and ones this plugin can't do (regular expressions, conditions) are listed with the reason. Importing again is safe.

= How are URLs matched? =

Paths are compared relative to your site's home URL. By default, matching ignores case and trailing slashes (`/About/` matches `/about`). Query strings are compared with their parameters in any order. Percent-encoded and plain characters are treated as the same (`/caf%C3%A9` matches `/café`). For each redirect you choose whether the query string must match exactly, is ignored, or is passed through to the target. The full rules are in docs/matching.md in the plugin's repository.

= Why are some 404s missing from the log? =

A few reasons, by design:

* Scanners, scripts and SEO tools (curl, WPScan, AhrefsBot and similar) aren't logged, and neither are requests without a user agent. Search engine crawlers such as Googlebot are logged, because their 404s are usually real broken links.
* Common probe paths such as `/.env`, `/.git/` and `/wp-config.php.bak` aren't logged. You can edit this list in the settings.
* New URLs are rate-limited (60 a minute by default), and the log stops adding new URLs at its row cap (10,000 by default). URLs already in the log keep counting hits either way.
* A full-page cache at your host, on a CDN like Cloudflare, or in a plugin like WP Rocket can serve a cached 404 without running WordPress. Those hits never reach the log.

= I added a redirect but still see the old page. Why? =

A full-page cache is probably serving a cached copy without running WordPress. When you save or delete a redirect, the plugin purges its URL from WP Rocket, LiteSpeed Cache, W3 Total Cache, WP Super Cache and SiteGround Optimizer. Other caches, such as your host's own cache or a CDN like Cloudflare, need purging by hand, or through the `subset_redirect_purge_url` action. Your browser also remembers 301 redirects, so test in a private window.

= Does the plugin contact any external services? =

No. It makes no remote requests and collects no usage data.

= Does the 404 log store IP addresses? =

No. It stores the URL, the referrer (without its query string), the user agent, a hit count and when the URL was first and last seen. Entries not seen for 30 days (configurable) are deleted daily.

= I uploaded the new version by hand and now see Subset Redirects twice =

Before 0.5.0 the plugin lived in a folder called `subset-redirect`, so uploading 0.5.0 adds it next to the old copy instead of replacing it. Both copies use the same settings. Deactivate the old copy, then delete it: the Plugins screen marks which one is the old copy. If you update through the Subset Installer you won't see this, because the update replaces the old folder.

== Screenshots ==

1. The redirects list, with the redirect tester.
2. Adding a redirect.
3. The 404 log, grouped by URL, with hit counts.
4. Importing a CSV file: a preview of what will happen before anything is saved.
5. Settings.

== Changelog ==

= 0.8.2 =
* Security: Renaming a post no longer redirects its old URL when another published post still lives there. Slugs are only unique within a post type, so an Author could rename a post away from `about` and send the real About page's visitors to it.
* Security: Publishing a post at a URL now only removes redirects there that the plugin made for a slug change. A redirect someone added by hand, or one from an import, stays unless the person publishing can manage redirects.
* Security: The Subset menu and its Overview page now need the same capability as a Subset page you can open, so a subscriber no longer reaches the Overview.
* Changed: Built on subset-core 1.13.3.

= 0.8.1 =
* Changed: Built on subset-core 1.13.2.

= 0.8.0 =
* Under the hood: the importers from other redirect plugins share more code with the other Subset plugins. They import the same redirects as before.
* Changed: Built on subset-core 1.12.0.

= 0.7.0 =
* Changed: The Redirects screen is now built on subset-core's tabbed page. It looks and works as before.
* New: For developers: the Subset → Redirects screen now uses subset-core's tabbed page, so add-ons add a tab with the `subset_redirects_admin_tabs` filter and print it on `subset_redirects_admin_tab_{slug}`. Two more hooks come with it: `subset_redirects_admin_load_{slug}` handles a form posted to the tab, and `subset_redirects_admin_enqueue` loads its scripts and styles.
* Deprecated: For developers: the `subset_redirect_admin_tabs` filter. It still works, but WordPress logs a deprecation notice under `WP_DEBUG` while an add-on uses it. Redirects Pro 0.3.0 and older log this notice until you update to Redirects Pro 0.4.0.

= 0.6.0 =
* Changed: Success, warning and info notices on the Redirects screens now carry `role="status"`, so screen readers announce them, as in the other Subset plugins.
* Under the hood: shares more code with the other Subset plugins, including the CSV import and export and the daily 404 log clean-up.
* Changed: Built on subset-core 1.11.1.

= 0.5.0 =
* Changed: The plugin now lives in a `subset-redirects` folder, with the text domain `subset-redirects`. If you update through the Subset Installer, nothing changes for you: the update moves it and keeps it active. Redirects, the 404 log, settings and integrations keep working.
* New: If you upload this version by hand, it lands next to the old `subset-redirect` copy. It waits until you deactivate the old copy, then takes over with the same settings, and the Plugins screen and Site Health tell you to delete the old copy.
* Changed: Built on subset-core 1.10.0.

= 0.4.2 =
* Fixed: `wp help` for the `settings` command is written for users, and its examples use this plugin's own command.
* Changed: Built on subset-core 1.9.1.

= 0.4.1 =
* Fixed: WordPress no longer logs a "translation loading was triggered too early" notice for this plugin on admin pages.
* Changed: Built on subset-core 1.9.0.

= 0.4.0 =
* Changed: The 404 log stores the linking page's address without its query string, so tokens or email addresses in that address aren't saved.
* Changed: Logging a 404 no longer counts every row in the log. The log's size limit is now exact to within a few rows.
* Fixed: The Site Health link about redirect chains and page caches opens the Subset docs instead of a page that didn't exist.
* Changed: Built on subset-core 1.8.1.

= 0.3.3 =
* Changed: The plugin is now called Subset Redirects. Settings and data are unchanged.

= 0.3.2 =
* Change: The About tab uses plain WordPress admin styling.

= 0.3.1 =
* Fix: accessibility and layout polish on the Redirects screen. Screen readers announce results once, bulk-action fields only show when needed, and the table keeps core's stacked mobile layout on small screens.
* Fix: form inputs no longer overflow narrow screens, and spacing now follows right-to-left languages.

= 0.3.0 =
* Change: Redirects now lives under the shared Subset menu (Subset > Redirects). The old Tools > Redirects address redirects there.

= 0.2.0 =
* New: an About tab with a short introduction to Subset and a link to subsetwp.com.

= 0.1.1 =
* Fix: the Add redirect button now sits beside the page title instead of under the tabs.

= 0.1.0 =
* First release: 301, 302 and 410 redirects; automatic redirects when slugs change; a 404 log; CSV import and export; import from Redirection, Yoast SEO Premium and Rank Math; Site Health checks; WP-CLI commands; a REST API; multisite support.
