WPThumbs
Themes Plugins By purpose By industry Best-of lists Fix it guides
Errors & downtime Beginner 2 min read

How to Fix 404 Errors on WordPress Posts and Pages

The classic symptom: the home page loads, every post 404s. That single pattern tells you it is permalinks, not content.

Updated 29 August 2026

There are two very different 404 problems in WordPress, and confusing them wastes hours.

  • The home page works, everything else 404s. The content exists; the server is not routing requests to WordPress. This is a rewrite-rules problem.
  • One specific URL 404s. That page is genuinely missing, in the trash, set to private, or its slug changed.

Diagnose which one you have before doing anything else.

Ninety percent of site-wide 404s are fixed here. Go to Settings → Permalinks and click Save Changes without altering anything. That single click regenerates the rewrite rules.

Rules get lost after a migration, a hosting change, or an interrupted update. Re-saving costs nothing, so try it first every time.

Fix 2: Check .htaccess on Apache

If re-saving did not help and you are on Apache or LiteSpeed, WordPress may not be able to write .htaccess. It should contain this block:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

If the file is missing, create it in the site root with exactly that content, permissions 644. If the block is there but ignored, mod_rewrite is not enabled or AllowOverride is set to None — both are host-side settings.

Fix 3: Check the nginx config

nginx does not read .htaccess at all, so no amount of editing it will help. The server block needs:

location / {
    try_files $uri $uri/ /index.php?$args;
}

Without that line, nginx looks for a literal file at /my-post-name/, does not find one, and returns its own 404 — WordPress is never consulted. A giveaway is that the 404 page is plain nginx text rather than your theme's 404 template.

That distinction is the fastest diagnostic available: if the 404 page is styled like your site, WordPress handled it. If it is a bare server page, the request never reached WordPress.

Fix 4: One page 404s and the rest are fine

Work through these:

  • Is it published, or still a draft or scheduled?
  • Is it in the trash?
  • Is its visibility set to Private? Private content 404s for logged-out visitors by design.
  • Did the slug change? WordPress usually creates an automatic redirect from the old slug, but that can be lost.
  • Does a page and a post share the same slug? One will win, the other 404s.

Fix 5: Custom post types

If only your products, events or portfolio items 404 while ordinary posts work, the custom post type was registered without flushing rules. Re-saving permalinks fixes it. If it recurs after every update, the plugin registering the type is at fault — it should flush on activation.

Fix 6: Case sensitivity after a migration

Moving from Windows hosting to Linux makes URLs case-sensitive. /My-Post/ and /my-post/ become different URLs. Normalise slugs to lower case and add redirects from the old capitalised forms.

Do not skip the redirects

If URLs genuinely changed, do not leave the old ones 404ing — every link and every ranking pointing at them is lost. Add 301 redirects from old URL to new. A redirect plugin handles this without touching server config, and Search Console's coverage report will tell you exactly which URLs still need one.

Common questions

Why does only the home page work?

The home page is served by index.php directly, so it does not need a rewrite rule. Every other URL does. When rewrites break, the home page is the only survivor — which is exactly the fingerprint of a permalink problem.

Does re-saving permalinks lose anything?

No. It regenerates rewrite rules from your existing settings. Content, URLs and settings are untouched.

I am on nginx and .htaccess changes do nothing.

Correct — nginx ignores .htaccess entirely. The try_files directive has to be in the nginx server block, which usually means editing the config or asking your host.