WordPress Pages Show 404 After Changing Permalinks: How to Fix It (2026)
If your homepage works but posts and pages show a 404 error, reset your permalinks first. Go to Settings > Permalinks and click Save Changes. If that does not work, check that your .htaccess file contains the standard WordPress rewrite rules, and ask your host to turn on mod_rewrite if it is off.
This problem usually appears after a site migration, a server move, or a change of permalink structure. The fixes below follow the order in the official WordPress handbook, from the quickest to the most technical.
Quick Diagnosis
| What you see | Likely cause | Start with |
|---|---|---|
| 404 on every post and page, homepage works | Rewrite rules not saved or .htaccess missing | Fix 1 |
| 404 started after a migration or server move | mod_rewrite off or .htaccess rules missing | Fix 2 and Fix 3 |
| 404 only on a custom post type | Name conflict or old rewrite rules | Fix 4 |
Before You Start
Back up your site and your .htaccess file before editing anything. If the site breaks, see our guide to the 500 internal server error.
Fix 1: Reset Your Permalinks
The handbook says to reset permalinks through Settings > Permalinks. Open that screen and click Save Changes without changing anything. This makes WordPress rebuild its rewrite rules and, on servers where it can write the file, update .htaccess. Test a post link afterwards.
Fix 2: Check the .htaccess Rules
If resetting does not work, the handbook says you may have to edit the .htaccess file manually. The standard WordPress block looks like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Open .htaccess in your site root through FTP or your file manager and compare. Keep any custom rules you already have, and keep a copy of the original file first. If the file looks corrupted, the same handbook suggests renaming it to .htaccess_old and then saving permalinks again to generate a clean one.
Fix 3: Ask Your Host About mod_rewrite
Pretty permalinks depend on mod_rewrite, an Apache module that rewrites URLs. The handbook notes it may not be enabled by default, and that the problem is most common on WordPress Multisite, on some shared hosts, and after a migration or server move. If you are not comfortable editing .htaccess, ask your host to turn on mod_rewrite rules for your account.
Fix 4: Custom Post Type 404 Errors
For 404 errors on custom post types, the handbook gives two steps. First, make sure none of your custom post types and single pages share the same name. If they do, rename the page, including its slug. Second, go to Settings > Permalinks, select the default permalinks and save, then select your preferred structure again and save. This flushes the rewrite rules.
How to Prevent It
- Save permalinks again after every migration or hosting change.
- Keep a copy of your working .htaccess file.
- Do not give a page the same slug as a custom post type.
Verified Facts and Sources
The steps above come from the permalink and custom post type sections of the WordPress handbook page on common errors. We did not reproduce a 404 on a test site for this article, so we describe the documented behavior only.
Frequently Asked Questions
Why do my WordPress pages show 404 but the homepage works?
The rewrite rules that map pretty URLs to WordPress are missing or not working. Resetting permalinks and checking .htaccess are the first fixes.
Does saving permalinks change my URLs?
Not if you leave the structure as it is. It only rebuilds the rewrite rules.
What is mod_rewrite?
An Apache web server module that rewrites URLs on the fly, which pretty permalinks need.
Why does only my custom post type return 404?
A page or post may share its name with the custom post type, or the rewrite rules are old. Rename the conflicting page and flush rules as described in Fix 4.
Updated December 2, 2026.