Check Your 404 to 301 Redirects for Chains and Dead Ends with AI
A read-only check of every 404 to 301 redirect: loops, dead ends, chains, hidden pages and stale rules.
Prerequisites
A site connected to WPVibe running the free 404 to 301 plugin, 4.0.5 or newer (tested on 4.0.5), on WordPress 6.9 or newer, with an administrator account.
My site uses the 404 to 301 plugin. Check every redirect rule and tell me which are broken, chained or out of date. Read only: change nothing. 1. Run discover_abilities with category 404-to-301-redirects. If it finds nothing, stop and tell me to install or update the free 404 to 301 plugin (4.0.5 or newer) on WordPress 6.9 or newer. 2. Run 404-to-301/redirects-list with per_page 100, orderby id and order ASC, and again with page 2 and up until you have read total rules. If total is 0, tell me there are no redirects and stop. 3. For each rule with is_active true, check: - Destination: for target_type page, run rest_api GET /wp/v2/pages/TARGET_PAGE_ID with context edit (or /wp/v2/posts/TARGET_PAGE_ID if that says not found). If its status is not publish, flag it: visitors are sent to a page they can't open. If neither finds it (a product or another kind of post), run 404-to-301/redirect-test with the rule's source: if its destination is null, flag the page as gone; otherwise say you couldn't check it and show me that destination. For target_type none, it is right only when redirect_type is 410 or 451 (the address is gone for good); otherwise flag it. For target_type link with an empty target_url, flag it: visitors get a plain not-found page and the address is no longer logged. - Chains and loops: skip rules whose match_type is regex and whose target_url holds a dollar sign and a number; list them for me to check by hand. Otherwise, when the destination is on my site, run 404-to-301/redirect-test with its path. If outcome is rule, flag a chain and follow it up to 5 hops to the final destination; if it comes back to an address already seen, flag a loop. - Hidden pages: for a rule with match_type exact, check its source. To see whether a published page or post lives at an address, take the last part of its path as the slug and run rest_api GET /wp/v2/pages and GET /wp/v2/posts with slug set to it: it lives there if a result's link ends with that path. If one does, flag that the rule sends visitors away from that live page. - Temporary codes: flag redirect_type 302, 303 or 307 on a rule created more than [90] days ago: it may be meant to be permanent. - Unused: list rules with hits 0 created more than [180] days ago as candidates to switch off. 4. List the rules with is_active false, so I can decide whether they are still wanted. 5. Run 404-to-301/settings-get. Never show me the Telegram bot token or chat id from the settings. If redirect_enabled is true, tell me every address with no rule is sent to redirect_link (my homepage when it is empty) or redirect_page. 6. Give me the problems in order of harm: loops, destinations that are gone or not published, rules with no destination, hidden live pages, chains, temporary codes, unused rules. For each: the rule's id, source, destination, the problem in one line, and the fix as the exact 404-to-301/redirect-update input (for a chain, repoint the first rule to the final destination). Then a count of rules that are fine.
Skip pasting the full prompt. Drop this into your AI on a site that already has WPVibe:
Run the “Check Your 404 to 301 Redirects for Chains and Dead Ends with AI” recipe from the WPVibe cookbook on my connected site.
Redirects pile up. A page is moved twice and its first redirect now hops through the second. A redirect points at a page that was later unpublished. A temporary redirect from a sale two years ago is still live, and a rule set up for an old page now hides a new one with the same address. None of it shows from the outside until someone complains.
The AI reads every redirect in 404 to 301, follows each one the way the plugin would for a visitor, and checks the page at the end. It reports loops, dead ends, chains, rules that hide a live page, temporary codes left in place and rules nobody uses, worst first, with the fix for each. It changes nothing.
It takes a few minutes. Rules with a pattern that copies part of the address into the destination are listed for you to check by hand. To fix the homepage catch-all for missing pages, use this recipe; to add redirects for moved pages, this one.
Outcome
A ranked list of broken, chained and stale redirects with the fix for each, and nothing changed.