To regenerate WordPress rewrite rules, sign in to the dashboard and open Settings > Permalinks. Simply loading that screen triggers a rewrite-rule flush. Click Save Changes only when you have changed the permalink structure. If you use WP-CLI, run wp rewrite flush; add --hard only when WordPress must also rewrite the site’s .htaccess file.
Choose the right regeneration method
| Method | What it does | Best for | Main caution |
|---|---|---|---|
| Dashboard: Settings > Permalinks | Flushes stored rewrite rules when the screen is visited; saving applies any changed permalink setting. | Most site owners and administrators. | If .htaccess is not writable, you may need to copy the displayed rules into the file manually. |
WP-CLI: wp rewrite flush |
Regenerates WordPress rewrite rules. With --hard, it also writes .htaccess. |
Administrators working from a shell or deployment process. | A hard flush can overwrite custom .htaccess directives. |
Regenerate permalinks from the WordPress dashboard
- Sign in with an account that can access the WordPress administration area.
- Open Settings > Permalinks.
- If you only need to refresh rewrite rules, stop after the screen loads. WordPress flushes the rules when the screen is visited; changing a setting is unnecessary.
- If you intentionally selected a different permalink structure, click Save Changes to apply it.
- Look for the message concerning
.htaccess. When the file is writable, WordPress can update its rules automatically. When it is not writable, the screen displays the generated rules for manual placement. - Test the URL that was returning an error, preferably in a private browser window or after clearing a caching layer.
When WordPress cannot write .htaccess
Do not replace the entire file blindly. Open the existing .htaccess, preserve site-specific directives, and add or update the WordPress rules shown on the Permalinks screen in the appropriate location. If you are unsure which directives are custom or which account owns the file, ask your hosting provider or administrator before editing it.
Regenerate rewrite rules with WP-CLI
Run the command from the WordPress installation context:
wp rewrite flush
This refreshes the rules stored for WordPress. Use the hard form only when the Apache configuration file also needs to be regenerated:
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute#1 Best Overall
wp rewrite flush --hard
A hard flush changes .htaccess as well as the stored rewrite rules. Review or back up the file first, because custom directives can be overwritten. For WP-CLI to generate the Apache file, its configuration must have the required mod_rewrite setup, typically specified in wp-cli.yml or config.yml.
Why a permalink refresh may not fix a 404
The web server is not configured for the selected structure
Pretty and Almost Pretty permalink formats depend on suitable web-server rewrite configuration. A flush cannot add missing server support. If the URL still fails after regeneration, ask the hosting provider to verify the server’s rewrite setup rather than repeatedly flushing WordPress.
Rank #2
The rules could not be written
An unwritable .htaccess file leaves the server using old or missing Apache directives. Use the rules displayed on the Permalinks screen, while retaining existing site-specific entries, or have the host apply them.
A plugin or theme registered rules after the last flush
Custom rewrite rules become effective only after they are registered and the rules are refreshed. Flush after activating or changing the plugin or theme, not on every page request. If the problem began immediately after an extension change, review that extension’s rewrite registration and configuration.
Rank #3
- Handy note taking workbook for students
- Use to improve research skills and test scores
- Offers effective strategies and reference section
- Apply to textbooks, novels, research, on-line resources and class lectures
- Illustrates Venn diagrams, webs, tables, lists, summaries and more
A hard flush removed a custom directive
Compare the current .htaccess with your backup or previous copy and restore required site-specific rules. If you cannot identify the missing directive safely, stop making repeated hard flushes and contact the host or developer responsible for the configuration.
Quick Recap
When to flush—and when not to
- Flush after changing the permalink structure.
- Flush after activating, deactivating, or changing code that registers custom rewrite rules.
- Use the dashboard method for a routine refresh when you have no need to rewrite
.htaccess. - Use
--hardonly when updating the Apache file is intentional and its custom rules are protected. - Never put a flush operation in a routine page-load hook. WordPress developer documentation warns that flushing can be extremely costly and should be used sparingly.
A practical decision path
- Start with Settings > Permalinks and test the affected URL.
- If WordPress reports that
.htaccessis not writable, apply the displayed rules manually while preserving custom directives. - If you prefer the command line, run
wp rewrite flush; reserve--hardfor a reviewed.htaccessupdate. - If the URL remains broken, investigate server rewrite support, file permissions, and the plugin or theme that owns the custom route.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

