Skip to content

How to Fix WordPress 404 Errors on Posts and Pages

Fix WordPress 404 errors: reset permalinks, restore .htaccess, check slugs and redirects, fix server rewrite rules and monitor broken links.
How to Fix WordPress 404 Errors on Posts and Pages — WebDesigningPune guide
Quick answer

If your homepage works but posts and pages show 404 Not Found, WordPress’s rewrite rules are missing. Go to Settings → Permalinks and click Save Changes — this regenerates the rules. If that fails, restore the default .htaccess file (Apache) or ask your host to add WordPress rewrite rules (Nginx). For individual missing pages, check the slug and add a 301 redirect from the old URL.

A WordPress 404 error means “page not found”. A few 404s are normal on any website — old links, typos and deleted pages happen. But if every post on your WordPress site suddenly returns 404 while the homepage works, something is wrong with how WordPress handles URLs, and visitors and search engines are hitting dead ends.

This guide covers both situations: fixing site-wide 404s and managing individual broken URLs.

404 errors come in two flavours: every post is broken (a rewrite problem) or a few URLs are missing (moved or deleted content). Here is how to fix both.

Important: Take a backup before editing wp-config.php, .htaccess or the database — see how to back up WordPress.

When all posts and pages return 404

  1. Re-save permalinksSettings → Permalinks → Save Changes (no changes needed).
  2. Check .htaccessOn Apache, make sure the WordPress block exists and the file is writable.
  3. Check mod_rewriteThe Apache rewrite module must be enabled.
  4. Nginx serversAsk your host to add try_files $uri $uri/ /index.php?$args; to the site configuration.
  5. Subfolder installsMake sure RewriteBase matches the folder, for example /blog/.
Screenshot or photo that supports “When all posts and pages return 404” in a guide about WordPress 404 error
# BEGIN WordPress (site at the domain root)
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

When some URLs return 404

  • Changed slug: add a 301 redirect from the old URL to the new one (Rank Math, Yoast Premium or a redirection plugin).
  • Deleted content: redirect to the most relevant page, or leave the 404 if nothing related exists.
  • Typos in links: fix internal links pointing to wrong URLs.
  • Draft or private content: publish it or remove links to it.

Monitor 404 errors

Clean illustration for “Monitor 404 errors” (topic: wordpress 404 error)

Fixing a site-wide WordPress 404 error in two minutes

  1. Resave permalinksSettings → Permalinks → Save Changes (without changing anything).
  2. Check .htaccessMake sure it contains the standard WordPress rewrite rules.
  3. Check the serverAsk your host whether mod_rewrite (Apache) or the right Nginx rules are enabled.
  4. Disable recent pluginsEspecially SEO, redirect or security plugins.

Make your 404 page helpful

  • Explain briefly that the page could not be found.
  • Include a search box.
  • Link to popular pages and main categories.
  • Offer a way to contact you.
  • Keep your site’s normal header and footer.

Use Google Search Console’s Pages report and an SEO plugin’s 404 monitor to find broken URLs, then redirect or fix them. A helpful custom 404 page with search and popular links keeps visitors on your site.

For a complete diagnostic method, see our WordPress troubleshooting guide.

Frequently asked questions

Why do my WordPress posts show 404 but the homepage works?

The permalink rewrite rules are missing or not being applied. Re-save permalinks and check .htaccess or your server’s rewrite configuration.

Do 404 errors hurt SEO?

404s for content that genuinely no longer exists are normal. Problems arise when important pages or pages with backlinks return 404 — redirect those to relevant pages.

Should I redirect all 404s to the homepage?

No. Redirect to the most relevant page. Mass redirects to the homepage can be treated as soft 404s and confuse users.

How do I find 404 errors on my site?

Use Google Search Console, an SEO plugin’s 404 monitor or a crawler such as Screaming Frog.

Should I redirect deleted pages?

Redirect pages that have a close replacement or backlinks. Let truly obsolete pages return 404 or 410.

Can a theme change cause 404 errors?

Occasionally, if the new theme lacks templates for certain post types or custom URLs. Resave permalinks and check templates.

How do I find which pages link to a 404?

Search Console and crawler tools show linking pages, so you can update internal links or add redirects.


Further reading: the official WordPress documentation.

First published November 17, 2026 · Last updated November 26, 2026