Skip to main content
Cookbook Maintenance

Fix broken permalinks with a rewrite flush with AI

Regenerate WordPress routing rules so pages stop 404ing after a slug or permalink structure change.

Difficulty Beginner
Time ~5 min
Tools run_wp_cli

Prerequisites

A connected site. A backup only if you are also changing the permalink structure itself, since old inbound links may need redirects.

The prompt
Pages on my site are returning 404 after I changed [the permalink structure / a page or post slug]. The content still exists, so I think the rewrite rules are stale. Please fix it in clear steps:

1. Show me the current permalink structure setting.
2. Confirm the broken URL [https://example.com/your-page/] actually returns a 404 right now.
3. Flush the rewrite rules to regenerate routing so they match the live structure.
4. Re-check that same URL and confirm it now returns 200.

List the before and after status codes so I can spot-check. Do not change my permalink structure setting itself unless I explicitly ask, and if a change like that is needed, stop and tell me first so I can back up and plan redirects.

Already connected to WPVibe?

Skip the copy-paste. Just ask your AI for the “Fix broken permalinks with a rewrite flush with AI” recipe, or describe the task, and WPVibe runs these steps on your own site.

You changed your permalink structure or renamed a page, and now links that worked yesterday throw 404s. Nothing is actually missing. WordPress is still matching incoming URLs against its old set of rewrite rules, so the new addresses point nowhere. It is the kind of thing that makes you think a page got deleted when it is really just a stale routing table, and clicking around in the admin does not make it obvious what went wrong.

WPVibe regenerates the rewrite rules for you. It reads your current permalink settings, confirms the broken URL really is 404ing, flushes the stored rules so they match your live structure, then re-checks the same URL to prove it resolves again. The flush only rebuilds routing rules. It never touches your posts, pages, or content, so there is nothing about your writing to undo.

Paste the prompt below and name the URL that is 404ing. The assistant reports the status code before and after so you can watch the fix land. A rewrite flush is safe to run on a live site. If you are also changing the permalink structure itself, take a backup first and plan redirects, because old inbound links to the previous structure will still need somewhere to go.

Outcome

Your rewrite rules are regenerated and the URLs that were 404ing resolve again.