=== KM 404 Redirect Manager ===
Contributors: ikashifmahmood
Tags: 404, redirect, 301 redirect, broken links, seo
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Track real 404 visits and manage exact, wildcard, or regex redirects with CSV tools and privacy controls.

== Description ==

KM 404 Redirect Manager helps WordPress administrators find broken URLs that are actually being visited and turn them into actionable redirect rules.

The plugin aggregates repeated 404 requests by URL, ranks them by hit count, and lets you create redirects directly from the 404 log. Redirect rules can use exact, wildcard, or regular-expression matching.

= Redirect features =

* 301, 302, 307, and 308 redirects.
* 410 Gone responses for permanently removed URLs.
* Exact path matching.
* Wildcard matching with capture reuse via `$1`, `$2`, and so on.
* Delimiter-free PCRE regular-expression rules.
* Enable or disable individual rules.
* Redirect hit counters.
* Internal or external HTTP(S) destinations.

= 404 monitoring =

* Aggregated 404 logs instead of one database row per visit.
* Broken URLs ranked by hit count.
* Unresolved and resolved states.
* Optional referrer logging.
* Optional user-agent logging.
* Optional one-way salted IP hashing; raw IP addresses are not stored.
* Optional common bot/crawler filtering.
* Optional administrator-visit filtering.
* Configurable automatic log retention.

= Import and export =

* Export redirect rules to CSV.
* Download a sample CSV.
* Validate and preview CSV rows before import.
* Import up to 2,000 validated rows per file.
* Existing rules with the same source and match type are updated during import.

= Privacy =

KM 404 Redirect Manager does not send analytics, logs, redirect rules, or settings to an external service. Referrer, user-agent, and hashed-IP collection are configurable, and the more privacy-sensitive options are disabled by default.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install the ZIP from Plugins > Add Plugin > Upload Plugin.
2. Activate **KM 404 Redirect Manager**.
3. Open **Tools > 404 Redirects**.
4. Review **404 Logs**, add redirect rules, and adjust the monitoring/privacy settings as needed.

== Frequently Asked Questions ==

= Where are the plugin settings? =

Go to **Tools > 404 Redirects**. The page contains tabs for 404 Logs, Redirects, Import / Export, and Settings.

= Does the plugin redirect only 404 pages? =

Redirect rules are evaluated on public front-end requests, so an administrator can intentionally redirect an existing path as well as a broken one. 404 logging itself only records requests WordPress resolves as 404 responses.

= Can I redirect to another domain? =

Yes. Administrator-created destinations may be site-relative paths or valid HTTP(S) URLs.

= What does wildcard matching support? =

An asterisk (`*`) captures matching text. Captures can be reused in the destination with `$1`, `$2`, and so on. For example, `/old/*` can redirect to `/new/$1`.

= How do regex rules work? =

Enter a delimiter-free PCRE pattern, such as `^/legacy/([0-9]+)/?$`. Captures can be reused in the destination.

= Does the plugin store visitor IP addresses? =

Not by default. If the IP-hash option is enabled, the plugin stores a salted one-way hash rather than the raw IP address.

= What happens to data when I uninstall the plugin? =

By default, data is retained to prevent accidental loss. Enable **Delete plugin data on uninstall** in Settings if you want uninstalling the plugin to remove its tables and settings.

== Changelog ==

= 1.0.0 =
* Initial release.
* Added aggregated 404 monitoring and hit ranking.
* Added exact, wildcard, and regex redirect rules.
* Added 301, 302, 307, 308, and 410 response handling.
* Added CSV preview, import, export, and sample file.
* Added bot, administrator, referrer, user-agent, IP-hash, retention, and uninstall privacy controls.
