WordPress 404 Error Page Not Found
What Is This Error?
A WordPress 404 error means your server received a request for a page but couldn’t route to it correctly. Instead of loading your post or page, visitors hit a dead end — which hurts both user experience and SEO rankings.
Here’s what most beginners miss: your content is almost certainly still in the database, completely untouched. This error is almost never about deleted content. WordPress uses a system called “pretty permalinks” to translate clean URLs like /about-us/ into something the server can locate. When that routing system breaks, every URL except the homepage can return a 404.
The good news is this is one of the most fixable errors in all of WordPress. In a majority of cases, a single button click in your dashboard is all it takes to resolve it completely.
Get free WordPress & AI tips
Join 500+ readers. No spam, unsubscribe anytime.
Why Does This Happen?
- Corrupted or missing .htaccess file — This file tells Apache how to handle WordPress URLs. If it’s gone or contains bad rules, every non-homepage URL breaks immediately.
- Permalink rules not flushed — After a fresh install, site migration, or URL structure change, WordPress needs to regenerate its routing rules. If that step was skipped, 404s follow.
- Apache mod_rewrite module is disabled — Pretty permalinks depend entirely on this Apache module. If it’s not active on your server, URL rewriting doesn’t work at all.
- Plugin or theme conflict — Some plugins hook into WordPress’s rewrite system and can accidentally corrupt it, especially right after an update.
- Site migration with mismatched URLs — Moving a site to a new domain or server without updating the WordPress Address in Settings causes widespread 404 errors across the entire site.
How to Fix It — Step by Step
- Re-save your permalink settings (start here)
In your WordPress dashboard, go to Settings → Permalinks and click Save Changes without altering anything. This forces WordPress to regenerate all rewrite rules and rewrite your .htaccess file automatically.
You should see: A green success notice at the top of the screen. Reload a post or page on your site — this single step resolves the error in most cases.
- Manually inspect and restore the .htaccess file
Connect to your server via FTP or your host’s File Manager. Find
.htaccessin your WordPress root folder (enable hidden files if you don’t see it). If it’s missing or stripped of WordPress rules, replace the contents with the standard block:# 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 WordPressYou should see: Posts and pages loading correctly after saving this file to the server.
- Verify Apache’s mod_rewrite module is enabled
If you have SSH access, check whether the module is active:
apache2ctl -M | grep rewriteIf it’s missing from the output, enable it and restart Apache:
sudo a2enmod rewrite && sudo systemctl restart apache2You should see:
rewrite_module (shared)listed in the output after enabling it. - Test for a plugin conflict
Go to Plugins → Installed Plugins, select all plugins, and choose Deactivate from the bulk action menu. Then test your site. If pages load, reactivate plugins one at a time until the 404 returns — that last plugin is the culprit.
You should see: Pages loading normally after bulk deactivation. The offending plugin will re-trigger the 404 when individually reactivated.
- Confirm your WordPress URL settings are correct
Navigate to Settings → General and verify that both WordPress Address and Site Address exactly match the domain you use to visit the site — including whether it uses
httpsand whether it includeswww.You should see: Both fields showing an identical URL. Any mismatch here triggers redirect loops that terminate in 404 errors.
Common Mistakes When Fixing This
- Switching permalink structure instead of just re-saving it — Changing from “Post name” to a different format breaks every existing URL on your site. Just click Save Changes on whatever structure is already selected — don’t touch the setting itself.
- Deleting .htaccess without replacing it — Removing a broken .htaccess and leaving nothing in its place gives the server zero routing instructions, making the problem significantly worse. Always replace it with the valid WordPress block, never just delete it.
- Overlooking http/https and www mismatches — A site configured as
http://example.combut accessed athttps://www.example.comwill silently generate 404s on inner pages after redirect chains. Fix the URLs in General Settings and add proper server-level redirects. - Applying the .htaccess fix on an Nginx server — Nginx completely ignores .htaccess files. The rewrite rules must live in your server block config instead. Add
try_files $uri $uri/ /index.php?$args;inside yourlocation /block, then runsudo systemctl reload nginx.
Frequently Asked Questions
Will re-saving permalinks delete my posts or pages?
Not at all. Saving permalink settings only refreshes WordPress’s internal URL routing table — it has zero effect on your database content. Every post, page, image, and comment remains completely intact.
Why does the 404 only appear on some pages but not others?
If your homepage loads fine but inner pages 404, it’s a rewrite rule problem — the homepage is served directly by index.php and bypasses the rewrite system entirely. If only specific pages are affected, check whether those pages had their slug recently changed, were moved under a different parent, or are being blocked by an SEO or redirect plugin.
My site runs on Nginx — does the .htaccess solution apply?
No. Nginx doesn’t process .htaccess at all. You need to add WordPress’s rewrite directive directly to your Nginx server block: place try_files $uri $uri/ /index.php?$args; inside the location / block of your config file, then reload Nginx with sudo systemctl reload nginx. Re-saving permalinks in WordPress won’t help on Nginx without this server-side change in place.
The fix works but the 404 keeps coming back — what’s causing that?
Something is repeatedly overwriting your rewrite rules. The most common culprits are caching plugins that lock old routing data, SEO plugins that rewrite the .htaccess on each update, or incorrect file permissions on .htaccess (it should be 644) that prevent WordPress from writing to it cleanly. Check your recently updated plugins first, then verify the file permission.
