=== IndexSweep ===
Contributors: cuyava
Tags: search console, crawl budget, seo, noindex, redirect
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Find the junk URLs wasting your crawl budget, fix them in one click, roll back anything. The fixer for "Crawled - currently not indexed".

== Description ==

Your Google Search Console "Page indexing" report is full of URLs that were crawled but not indexed — and most of them are junk your site never meant to publish: feed URLs, parameter variants, malformed-link artifacts, leftover ad-tech and redirect-plugin endpoints.

Your SEO plugin shows you index status. **IndexSweep fixes it**:

* **Audit** — a configuration scan of the junk sources your site exposes right now, plus a content-link scan that finds the *sources* of junk URLs (like malformed relative links minting ghost pages) inside your posts.
* **GSC Import** — upload your Search Console export; every URL is classified against a pattern library of real-world junk, with a plain-English explanation and a recommended action. Nothing leaves your server.
* **One-click fixes** — apply reversible rules: 410 Gone, X-Robots-Tag noindex, or clean-URL redirects. No .htaccess edits, no file changes.
* **Full rollback** — every rule is one click to remove; every change is logged with hit counts.

**Safety first.** A resolvable page can never be served a 410 — every destructive rule passes a safety check against your real permalinks, pagination, and archives before it acts. IndexSweep also respects your SEO plugin (Yoast, Rank Math, All in One SEO) — it never duplicates or overrides their settings.

== Installation ==

1. Install and activate through the WordPress plugins screen, or upload the `indexsweep` folder to `/wp-content/plugins/`.
2. Go to **Tools → IndexSweep**.
3. Run the configuration audit, then export your "Page indexing" report from Google Search Console (Indexing → Pages → open a reason → Export) and upload the CSV in the **GSC Import** tab.

== Frequently Asked Questions ==

= Will this break my site? =
Every fix is a reversible request-time rule with a full change log. A safety check prevents 410s on any URL that resolves to real content — posts, pages, pagination, date and term archives. Nothing edits your files.

= Do I need a Google account or API access? =
No. IndexSweep works entirely from the CSV export you download from Search Console yourself. No OAuth, no API keys, no Google connection.

= Does this send my data anywhere? =
No. CSV analysis happens entirely on your server. IndexSweep makes no external requests at all.

= What if I have Yoast / Rank Math / All in One SEO? =
Keep it. IndexSweep detects your SEO plugin and stays out of its way — it only handles junk-URL remediation, which SEO plugins don't do.

= How do I undo a fix? =
Tools → IndexSweep → Rules & Log → Roll back. The rule is removed immediately; the change log entry is kept for your records.

== Screenshots ==

1. Audit tab — configuration scan and content-link scan showing junk sources the site exposes.
2. GSC Import tab — a Search Console export classified against the pattern library, with recommended actions.
3. Rules & Log tab — one-click pattern fixes, active reversible rules with hit counts, and the change log.

== Changelog ==

= 0.1.1 =
* The 410 response now uses the native WordPress error page (wp_die) instead of a custom HTML template, and the filterable message is escaped on output.
* Admin styles and the select-all script are now static files loaded with wp_enqueue_style/wp_enqueue_script (no inline style or script attributes).
* Fixed: a clean-URL redirect for a malformed "//post-slug/" URL now resolves to the canonical article instead of the site home page.
* The affiliate/redirect-endpoints pattern is now clearly marked advisory: its paths (/go/, /refer/, /recommends/) can also be real pages, so it is offered as a robots.txt suggestion instead of a site-wide rule that could noindex live content.
* Fixed: fixing a link now unwraps only the reported anchor, even when the same link appears more than once in the post.
* Fixed: array-style query parameters (?filter[]=red) survive a clean-URL redirect instead of being emptied.
* Fixed: "Restore original link" is now refused after a link has already been restored, preventing a rare content-corruption case.
* Safety: deep single-post pagination (/slug/100/) is now protected from the numeric-suffix redirect; the hit counter only counts requests a rule actually acts on.
* Fixed: fixing or restoring a link no longer strips literal backslashes from the rest of the post (code snippets, Windows paths).
* Fixed: an inapplicable rule no longer stops later rules from acting on the same request, while any rule vetoed by a safety check still shields the page from all remaining rules.
* Safety: term-archive protection now works regardless of language/term filters and matches non-ASCII archive slugs in either encoded or decoded form.

= 0.1.0 =
* Initial release: configuration audit, content-link scan, GSC CSV analyzer with junk-pattern library, reversible fix engine (410 / noindex / clean redirect), hit counting, change log with one-click rollback.

== Upgrade Notice ==

= 0.1.0 =
Initial release.
