Few things are as alarming as clicking on your own blog post and seeing "404 Not Found." Often the homepage still works, which makes it even more confusing. The content has not vanished. In most cases WordPress simply cannot translate the pretty URL into the right post, and the fix takes a couple of minutes.
This guide walks through the causes of WordPress 404 errors and how to fix each one, starting with the quickest solutions.
First, figure out what kind of 404 you have
The fix depends on the pattern:
- Every post and page shows a 404, but the homepage works. This is almost always a permalink or
.htaccessproblem. Start with Fix 1. - One or a few specific URLs return a 404. The content was likely deleted, its slug changed or the link is wrong. Skip to Fix 5.
- The dashboard (
/wp-admin/) returns a 404 too. The problem is probably at the server or folder level. See Fix 4. - Only images or uploaded files are missing. Check that the files exist in
wp-content/uploadsand that the URLs in your content are correct, especially after a migration.
Fix 1: Re-save your permalinks
This solves the "everything except the homepage" problem more often than anything else.
- Log in to your dashboard.
- Go to Settings → Permalinks.
- Do not change anything. Just click Save Changes.
WordPress rebuilds its rewrite rules and, if it can, rewrites the WordPress section of .htaccess. Reload one of your posts. If it works, you are done.
Fix 2: Restore the default .htaccess file
On Apache and LiteSpeed servers, which most shared hosting uses, a file named .htaccess in your site's root folder tells the server to pass pretty URLs to WordPress. If that file is missing, damaged or overwritten by a plugin, posts return 404 errors.
Find the file
Open your hosting file manager and go to the folder where WordPress is installed (usually public_html). Files that start with a dot are hidden by default, so turn on Show Hidden Files in the file manager settings.
Back it up
If the file exists, download a copy or rename it to .htaccess-old before editing. It may contain other important rules, such as HTTPS redirects or caching rules, that you will want to keep.
Add the default WordPress rules
For a standard single-site install in the root folder, the WordPress block looks like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
If WordPress lives in a subfolder such as /blog/, change RewriteBase / to RewriteBase /blog/ and the last rule to RewriteRule . /blog/index.php [L].
Save the file, then re-save your permalinks once more.
Check the file permissions
.htaccess should normally have permissions of 644. If WordPress says it cannot write to the file, check the permissions in your file manager.
Fix 3: Rule out plugins and themes
Security, redirect, caching and multilingual plugins all modify URL handling. If a 404 started right after installing or updating one:
- Deactivate all plugins (if you cannot reach the dashboard, rename the
wp-content/pluginsfolder using the file manager). - Re-save permalinks and test.
- Reactivate plugins one at a time until the 404 returns.
Switching temporarily to a default theme such as Twenty Twenty-Four can rule out a theme that registers custom post types incorrectly.
Fix 4: Check the server and site address settings
If even /wp-admin/ gives a 404:
- Confirm the site address. In the database table
wp_options(the prefix may differ), checksiteurlandhome. They should match your real domain, includinghttps://andwwwif you use it. - Check the document root. After a migration or domain change, the domain may point to a different folder than the one WordPress is in. Your hosting control panel shows the folder each domain uses.
- Nginx servers do not use .htaccess. On a VPS running Nginx, the equivalent rule lives in the server configuration, usually
try_files $uri $uri/ /index.php?$args;. - mod_rewrite must be enabled. On managed shared hosting it almost always is. On your own server, make sure the rewrite module is active and
AllowOverridepermits.htaccessfiles.
Fix 5: Fix individual missing pages
When only some URLs fail:
- Look in the trash. Go to Posts → All Posts or Pages → All Pages and check the Trash tab.
- Check whether the slug changed. Editing a post's slug changes its URL. WordPress often redirects old slugs automatically for posts, but not always.
- Find broken links. Google Search Console's Pages report lists URLs returning "Not found (404)." Many SEO plugins also log 404s.
- Set up 301 redirects. Use a redirect plugin to send each dead URL to the most relevant live page. Avoid sending everything to the homepage, which search engines may treat as a "soft 404."
Make your 404 page helpful
Some 404s will always happen, from mistyped URLs to old links on other websites. A good 404 page keeps those visitors on your site. Include a short friendly message, a search box, links to popular posts and a link to your homepage. Most themes let you customize the 404 template, and block themes let you edit it directly in the Site Editor.
Wrap-up
When every post suddenly shows a 404, re-save your permalinks and restore the default .htaccess rules. Those two steps fix the large majority of cases. If the problem persists, rule out plugins, then check your site address and server setup. For individual missing pages, restore from the trash or add 301 redirects, and keep an eye on Search Console so new 404 errors get caught early.