WordPress 404 Error on Posts: How to Fix It Fast

WordPress 404 error on posts usually means the post exists in WordPress, but the server cannot rewrite the URL correctly. In most cases, the homepage works, pages may work, and the admin area works, but single posts return 404 instead of loading normally.

This is one of the most common WordPress permalink problems. The good news is that it is usually caused by a broken rewrite rule, bad permalink settings, plugin conflict, or server configuration issue, and most cases are fixable in minutes.

Quick Fix

  • Go to Settings → Permalinks and click Save Changes.
  • Check that your .htaccess file exists and has the default WordPress rewrite rules.
  • Temporarily switch to the default permalink structure and then switch back.
  • Disable recent plugins, especially SEO, redirect, cache, or security plugins.
  • Clear all cache layers: browser, plugin, server, and CDN.
  • Make sure Apache mod_rewrite is enabled, or confirm NGINX rewrite rules are correct.
  • Check whether only posts fail or categories, tags, and custom post types fail too.
  • Review site URL settings and recent migration changes.

What Is the WordPress 404 Error on Posts?

WordPress 404 error on posts happens when WordPress cannot map a post URL to the correct content, even though the post still exists in the database.

This is different from a true missing page. In many cases:

  • the post is still published,
  • you can see it in wp-admin,
  • the homepage works,
  • the admin dashboard works,
  • but the post URL returns a 404 page.

That pattern usually points to one layer: permalink and rewrite handling.

WordPress uses rewrite rules to turn clean URLs such as:

https://example.com/sample-post/

into internal requests WordPress can understand. If those rules are missing, outdated, or overridden badly, posts often break first.

Why WordPress Shows 404 Errors on Posts

Most cases come from a short list of common causes.

1. Broken Permalink Rules

This is the most common cause.

WordPress stores permalink settings and rewrite rules separately from the actual post content. If the rewrite rules become stale or invalid, the server no longer knows how to route post URLs properly.

This often happens after:

  • changing permalink structure,
  • migrating the site,
  • restoring from backup,
  • changing server setup,
  • deactivating or activating plugins.

2. Missing or Broken .htaccess Rules

On Apache-based hosting, WordPress depends heavily on the .htaccess file for pretty permalinks.

If the file is missing, corrupted, overwritten, or blocked by bad permissions, post URLs can return 404 even when the content still exists.

This is especially common after:

  • manual changes to .htaccess,
  • security plugin edits,
  • migration tools,
  • server restores,
  • switching permalink structures.

3. Apache mod_rewrite Is Disabled

If Apache rewrite support is missing or not working, WordPress permalinks usually fail.

In that situation, you may notice:

  • homepage works,
  • plain URLs may work,
  • pretty permalinks break,
  • single posts return 404.

4. NGINX Rewrite Rules Are Wrong or Missing

NGINX does not use .htaccess. It needs the correct server block rules instead.

So if you are using NGINX, clicking “Save Changes” in permalink settings may not be enough by itself. WordPress can update internal rules, but NGINX still needs to route requests correctly.

5. A Plugin Changed Rewrite Rules

Some plugins register their own rewrite rules or flush rules at the wrong time.

Common suspects include:

  • SEO plugins,
  • redirect plugins,
  • custom post type plugins,
  • membership plugins,
  • multilingual plugins,
  • security plugins.

A plugin conflict can break normal post URLs without breaking the admin panel.

6. Custom Post Types or Taxonomies Are Interfering

Even if the main problem seems limited to blog posts, rewrite conflicts from custom post types can spill over into regular post URLs.

This is more likely if the issue started after installing:

  • a course plugin,
  • a product plugin,
  • a listings plugin,
  • a portfolio plugin,
  • custom code that registers rewrite slugs.

7. Site URL or Migration Settings Are Wrong

After a migration or domain change, WordPress may still be using old URL assumptions.

This can affect:

  • permalinks,
  • canonical redirects,
  • internal links,
  • rewrite behavior.

If the site moved from HTTP to HTTPS, from www to non-www, or from staging to production, this becomes much more likely.

8. Cache Is Showing Old 404 Pages

Sometimes the post is already fixed, but cache makes it look broken.

This can happen with:

  • WordPress cache plugins,
  • hosting cache,
  • reverse proxy cache,
  • CDN cache,
  • browser cache.

Cache does not usually create the original permalink problem, but it can make diagnosis much more confusing.

How to Fix WordPress 404 Error on Posts Step by Step

Work through these in order. In most cases, one of the first few steps solves it.

1. Save Permalink Settings Again

This is the first fix to try because it is fast and often works immediately.

Go to:

Settings → Permalinks

Then click:

Save Changes

Do this even if you do not change anything first.

This forces WordPress to flush and rebuild its permalink rules.

If post URLs start working after that, the issue was probably stale rewrite rules.

2. Switch Permalink Structure Temporarily

If simply saving does not work, force a stronger refresh.

  1. Go to Settings → Permalinks.
  2. Switch to Plain.
  3. Save changes.
  4. Then switch back to your preferred structure.
  5. Save changes again.

This often clears broken permalink state more effectively than a single save.

3. Check the .htaccess File

If you use Apache or LiteSpeed, inspect the root .htaccess file.

A standard WordPress version usually 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

Check whether:

  • the file exists,
  • the rules are present,
  • bad custom redirects were added above or below them,
  • permissions allow WordPress to write to the file if needed.

If the file is broken, back it up and restore the clean WordPress version.

4. Confirm mod_rewrite Is Enabled

On Apache-based servers, pretty permalinks depend on rewrite support.

If mod_rewrite is disabled, WordPress post URLs will often return 404 even with the correct permalink settings and .htaccess file.

If you are on shared hosting, your host may need to verify this for you.

5. Check NGINX Rewrite Configuration

If your server uses NGINX, .htaccess is not the answer.

You need the correct server block rules so NGINX routes unknown URLs to WordPress properly.

A common WordPress-compatible pattern is to route requests through index.php when no real file or folder exists.

If your post URLs broke after moving to NGINX, this should be one of the first checks.

6. Clear All Cache Layers

After fixing rewrite settings, clear cache everywhere.

  • clear your browser cache,
  • clear WordPress cache plugin cache,
  • clear hosting or server cache,
  • clear CDN cache if you use one.

Then test the affected post in a private window.

This helps confirm whether the 404 is still real or only cached.

7. Disable Recently Changed Plugins

If the problem started after a plugin install or update, disable the likely suspects first.

Focus on:

  • SEO plugins,
  • redirect plugins,
  • custom post type plugins,
  • multilingual plugins,
  • membership plugins,
  • security plugins.

After disabling one, resave permalinks and test again.

If wp-admin is inaccessible, rename the plugin folder manually under:

/wp-content/plugins/

8. Check the Post Slug and Permalink Conflicts

Sometimes the problem is more specific than global permalinks.

Check whether:

  • the post slug conflicts with a page slug,
  • a category base overlaps with the post slug,
  • the post uses a reserved word,
  • a custom post type is using the same rewrite slug.

If only one or a few posts return 404, slug conflict becomes much more likely.

9. Re-save the Affected Post

If only one post is broken, open it in wp-admin and update it again without major changes.

This can refresh the permalink mapping for that specific post.

You can also try:

  • changing the slug slightly,
  • saving the post,
  • then changing it back if needed.

10. Check Site URL Settings

Make sure WordPress is using the correct site address.

Check:

  • WordPress Address (URL)
  • Site Address (URL)

Watch for:

  • HTTP vs HTTPS mismatch,
  • www vs non-www mismatch,
  • staging domain leftovers,
  • subdirectory mistakes.

If needed, define them temporarily in wp-config.php:

define('WP_HOME', 'https://example.com');
define('WP_SITEURL', 'https://example.com');

Use your real domain, not the example above.

11. Switch to a Default Theme

If plugins are not the cause, test the theme.

The active theme can interfere with:

  • query handling,
  • rewrite behavior,
  • custom templates,
  • redirect logic.

Temporarily switch to a default WordPress theme and test post URLs again.

If the 404 disappears, the theme or theme-level custom code needs review.

12. Review Custom Rewrite Code

If your site uses custom code in:

  • functions.php,
  • MU plugins,
  • custom plugins,
  • server config files,

then inspect anything that touches:

  • rewrite rules,
  • redirects,
  • request parsing,
  • canonical URL handling.

Custom rewrite logic is a common hidden cause.

13. Check for Category, Tag, and Archive Failures Too

This helps narrow the scope.

  • If only single posts fail, focus on permalink routing and slug conflicts.
  • If categories, tags, and custom post types fail too, the rewrite system is more broadly broken.
  • If only one post type fails, check that post type registration and rewrite slug setup.

14. Review Logs for Rewrite or Redirect Clues

If the problem survives the usual fixes, stop guessing and check logs.

Look at:

  • web server logs,
  • PHP logs,
  • WordPress debug log,
  • hosting logs if available.

Look for:

  • rewrite failures,
  • redirect loops,
  • permission errors,
  • plugin-generated redirects,
  • missing file assumptions.

Advanced Troubleshooting

Compare Working Pages vs Broken Posts

This is one of the best diagnostic checks.

Ask:

  • Do pages work but posts fail?
  • Do category archives work?
  • Do custom post types fail too?
  • Does only one slug pattern break?

The answer tells you whether the issue is global, post-specific, or structure-specific.

Flush Rewrite Rules Programmatically If Needed

Developers sometimes need to flush rewrite rules in code after registering custom post types or taxonomies correctly.

But this should be done carefully. Flushing rules on every page load is bad practice and can create performance problems or unstable behavior.

If a plugin needs a one-time rule refresh after activation, handle it on activation, not continuously.

Inspect Migration and Search-Replace Work

If the issue started after migration, review:

  • database URL replacements,
  • serialized data handling,
  • old domain references,
  • HTTPS changes,
  • reverse proxy settings.

Migration mistakes often leave homepage access intact while post URLs break.

Check Canonical Redirect Behavior

Some SEO or redirect plugins create canonical redirects that interfere with post URLs.

This is more likely if:

  • the post URL changes unexpectedly,
  • one slug redirects badly,
  • 404 appears only after one redirect hop,
  • the site recently changed structure.

Test the Site with All Caching Disabled

If you still cannot get a clean answer, disable caching completely for a short test.

This includes:

  • plugin caching,
  • server cache,
  • CDN cache,
  • object cache if it may affect routing behavior indirectly.

This gives you the cleanest possible result.

Prevention Tips

  • Do not edit rewrite rules casually.
  • Resave permalinks after major plugin or structure changes.
  • Test post URLs after migrations and SSL changes.
  • Keep redirect and SEO plugins to the minimum you really need.
  • Avoid slug conflicts between posts, pages, categories, and custom post types.
  • Back up .htaccess before changing it.
  • Use staging for major permalink or structure changes.
  • Clear all cache after permalink fixes.

The best prevention is simple: keep permalink structure stable and test single posts immediately after any migration, redirect change, or plugin update that touches URLs.

When to Contact Support

Contact your hosting provider if:

  • mod_rewrite may be disabled,
  • NGINX rules are unclear,
  • .htaccess is not writable or keeps resetting,
  • server logs point to rewrite or config issues you cannot change yourself.

Contact the plugin or theme developer if:

  • the 404s started after their update,
  • the problem disappears when their plugin or theme is disabled,
  • their code registers custom post types, taxonomies, redirects, or SEO rules.

Focus on WordPress-level troubleshooting if:

  • the admin area works,
  • the posts exist,
  • single post URLs return 404,
  • the issue started after permalink or migration changes.

FAQ

Why do my WordPress posts show 404 but pages work?

Usually because permalink rewrite rules are broken. Pages may still work in some setups while single post routing fails first.

How do I fix WordPress 404 error on posts fast?

Go to permalink settings and save them again, then check the .htaccess file or NGINX rewrite rules, clear cache, and disable any plugin that may affect redirects or permalinks.

Can a plugin cause WordPress post 404 errors?

Yes. SEO plugins, redirect plugins, custom post type plugins, multilingual plugins, and security plugins can all interfere with WordPress rewrite handling.

Does .htaccess cause WordPress 404 errors on posts?

Very often on Apache-based hosting, yes. If the file is missing, corrupted, or contains bad rewrite rules, pretty permalinks can fail and return 404 on posts.

Why did WordPress posts start showing 404 after migration?

Because migrations often affect permalink rules, site URLs, rewrite setup, HTTPS handling, or cached redirects. The content may still exist, but the routing layer no longer matches the new environment.

Final Thoughts

WordPress 404 error on posts usually looks like missing content, but most of the time the posts are still there. The real problem is the route between the clean URL and the actual WordPress request handling.

Start with permalink settings, then check .htaccess or NGINX rules, clear cache, and isolate plugins or theme changes. That order fixes most post 404 problems much faster than editing random settings blindly.

Related WordPress Errors

Leave a Comment