Fix broken redirects, permalinks, and rewrite rules
Repair redirects, permalink rules, rewrite configuration, and route mismatches that cause 404s or redirect loops after site changes.
When to use this guide
Use this when pages that should exist return 404, old URLs no longer land on new URLs, or a site starts looping after changing slugs, migrations, permalink settings, reverse proxy rules, or web server config.
Steps
- Confirm the status code. Use
curl -I https://example.com/pathor browser developer tools. A real 404, a soft 404, and a redirect loop need different fixes. - Check whether the resource exists. Confirm the post, file, route, controller, or static asset still exists and has the expected slug or filename.
- Trace redirects one hop at a time. Use
curl -I -Lonly after first checking the first response. The first wrong hop is usually the fix location. - Regenerate application routes. In WordPress, save Permalink Settings without changing the structure. In custom apps, rebuild route caches if the framework uses them.
- Inspect server rewrite rules. Check nginx
try_files, Apache.htaccess, and proxy prefix rules for stale paths or missing front-controller fallbacks. - Add explicit redirects for moved content. Use permanent redirects for stable URL moves. Avoid redirecting every missing page to the home page.
- Clear only routing-related caches. Purge CDN or page cache after the route fix is in place.
Verify
Test one current URL, one moved URL, one intentionally missing URL, and one asset URL. The moved URL should return one clean redirect to the final destination, while truly missing content should still return a real 404.
Rollback or escalate
If rewrite edits break more routes, restore the previous config and reload the server. Escalate with the failing URL, expected destination, redirect chain, and the relevant rewrite or permalink setting.
Review notes
- Last reviewed
- 2026-05-05
- Reviewed by
- FaultForge Editorial Team, Web operations reviewer
- Tested on
HTTP status checks, access and error log review, server response headers, recent deployment review, and safe rollback verification.