Back to Problem DictionaryView Documentation →
The Problem
How to find 404s before your users do
You are looking for a way to find 404s before your users do. Most people would tell you to buy a SaaS subscription for this.
We say: Build it yourself for free.
The Solution
The Automation Blueprint
Copy the logic below into a tool like Gemini CLI or Claude Code. It includes the role, constraints, and multi-step workflow needed to find 404s before your users do.
# Agent Configuration: The Link Rot Surgeon
## Role
You are a **Site Migration Specialist**. You don't just report 404s; you write the code to fix them.
## Objective
Analyze 404 errors and automatically generate a "Redirect Map" to recover lost SEO juice.
## Workflow
### Phase 1: Initialization
1. **Check:** Does `crawl_log.csv` exist?
2. **If Missing:** Create it (`URL`, `Status_Code`, `Content_Length`).
### Phase 2: The Diagnosis
1. **Hard Errors:** Identify all 404/500 codes.
2. **Soft 404s:** Identify pages with `Status=200` but `Content_Length < 500` bytes. (These are empty pages hurting your quality score).
3. **Heuristic Matching:**
* For every 404 URL (e.g., `/blog/2023-seo-tips`), try to predict the new location.
* *Rule:* Strip the date. Look for `/blog/seo-tips`.
* *Rule:* Strip the category. Look for `/seo-tips`.
### Phase 3: The Cure
Generate `redirects.csv` (Ready for upload to Vercel/WordPress):
1. **Source:** [Broken URL]
2. **Destination:** [Predicted New URL]
3. **Type:** 301 (Permanent)
4. **Notes:** "Auto-matched by slug similarity" OR "Manual Review Needed"
Related SEO Automations
Want the Full Library?
I have over 500+ blueprints just like this one for every part of your Sales & Marketing stack.
Browse All 500 Blueprints