Skip to content

How to Fix 404 Errors on a WordPress Site

WordPress 404 errors happen when a URL points to content that does not exist at that address. The most common fix is resaving your permalinks, which regenerates the .htaccess rewrite rules.

How to Fix 404 Errors on a WordPress Site

Why is your WordPress site showing 404 errors?

A 404 means the server received the request but could not find content at that URL. In WordPress, this happens for five distinct reasons, each with a different fix:

CauseSymptomsFix
Broken permalink rewrite rulesAll posts/pages 404, homepage worksResave permalinks
Deleted or trashed contentSpecific URLs 404Restore content or redirect
Changed permalink structureOld URLs 404, new ones workSet up 301 redirects
Plugin conflict with rewrites404s started after plugin activationDeactivate and test
Server .htaccess or Nginx config issuePermalinks save but 404s persistFix server configuration

The first step is always identifying which category your 404 falls into. That determines the fix.

How do you fix 404 errors by resaving permalinks?

This fixes the majority of WordPress 404 issues. When WordPress permalink rewrite rules get corrupted or deleted, the server does not know how to route pretty URLs to the correct content.

Steps:

  1. Log into wp-admin
  2. Go to Settings > Permalinks
  3. Do not change anything – just click “Save Changes”
  4. Test the URLs that were returning 404

What this does: WordPress regenerates the .htaccess file (Apache) or flushes rewrite rules (Nginx with WordPress-managed config) with the correct URL patterns.

If you cannot access wp-admin (because wp-admin itself is 404ing):

Access your site via FTP/SFTP and check if .htaccess exists in the root directory. If it is missing or empty, create it with these default WordPress rewrite rules:

# 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

If the file exists but is not writable, check permissions. WordPress needs write access to .htaccess to update rewrite rules. Set permissions to 644.

How do you fix 404 errors from deleted or moved content?

If specific URLs return 404 but the rest of your site works, the content at those URLs was either deleted, trashed, or moved to a different URL.

Check the trash first:

Posts and pages go to trash before permanent deletion. Go to Posts > All Posts > Trash (or Pages > All Pages > Trash). If your content is there, restore it.

If content was permanently deleted:

You have two options:

  1. Recreate the content at the same URL
  2. Set up a 301 redirect from the old URL to the most relevant existing page

Setting up 301 redirects:

Using Rank Math (already installed on this site): go to Rank Math > Redirections > Add New. Enter the old URL as the source and the destination URL as the target. Choose 301 (permanent) redirect type.

Or via .htaccess for bulk redirects:

Redirect 301 /old-page-slug/ /new-page-slug/

301 redirects preserve most of the SEO value from the old URL. Google will transfer ranking signals to the new destination within a few weeks.

How do you fix 404 errors after changing permalink structure?

If you changed your permalink structure (e.g., from /2026/05/post-name/ to /post-name/), every old URL is now broken. Google has the old URLs indexed. Backlinks point to old URLs. Bookmarks use old URLs.

The fix: bulk 301 redirects from old structure to new.

For simple structure changes, a plugin like Redirection or Rank Math’s redirect module can handle pattern-based redirects:

  • Old: /2026/05/my-post/ → New: /my-post/
  • Pattern: /\d{4}/\d{2}/(.+)/$1

Before changing permalinks in the future:

  1. Export a list of all current URLs (use Screaming Frog or WP All Export)
  2. Change the permalink structure
  3. Set up redirects from every old URL to its new equivalent
  4. Test a sample of redirects to verify they work
  5. Submit updated sitemap to Google Search Console

Changing permalink structure without redirects is one of the most damaging SEO mistakes I see. A site with 100 indexed pages that all suddenly 404 can lose 50-80% of organic traffic within days.

How do you fix 404 errors caused by plugin conflicts?

Some plugins register custom rewrite rules (custom post types, custom endpoints, portfolio pages, event calendars). When these plugins conflict with each other or with your theme, URLs break.

Diagnosis:

If 404 errors started after activating or updating a plugin:

  1. Deactivate the most recently changed plugin
  2. Resave permalinks
  3. Test the broken URLs

If they work now, the deactivated plugin was the cause. Check for updates, contact the developer, or find an alternative.

Common plugin-related 404 causes:

  • Two plugins registering the same URL slug (e.g., both want /events/)
  • A plugin registering a custom post type with a slug that conflicts with a page
  • WooCommerce shop page slug conflicting with a regular page
  • A caching plugin serving stale 404 responses after content is published

For caching-related 404s: clear your page cache and object cache after publishing new content. Some caching plugins aggressively cache 404 responses, meaning a URL that was 404 before you published content continues to serve 404 from cache.

How do you fix 404 errors on an Nginx server?

If your site runs on Nginx (common with managed WordPress hosts like Kinsta, Flywheel, and some WP Engine configurations), the .htaccess file is irrelevant. Nginx does not read .htaccess.

WordPress rewrite rules on Nginx are handled in the server configuration block:

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

If this directive is missing or incorrect, pretty permalinks will 404. On managed hosts, this is configured automatically — contact support if it breaks. On self-managed Nginx, add the directive to your site’s server block and reload Nginx:

sudo nginx -t && sudo systemctl reload nginx

How do you find and fix all 404 errors on your WordPress site?

Fixing individual 404s is reactive. A proactive approach finds all broken URLs before visitors (or Google) hit them.

Tools for finding 404 errors:

  1. Google Search Console > Pages > Not Found: Shows URLs Google tried to crawl that returned 404
  2. Screaming Frog: Crawls your site and reports all internal links pointing to 404 pages
  3. Server access logs: Shows every 404 request with the referring URL
  4. Redirection plugin: Logs 404 hits in real-time with the URL and referrer

Priority for fixing:

  1. URLs with backlinks from external sites (you are losing link equity)
  2. URLs that Google has indexed (they will show as errors in Search Console)
  3. URLs linked from within your own site (broken internal links hurt UX and crawl efficiency)
  4. URLs with significant traffic (check analytics for pages returning 404)

Low-traffic 404s from random bot probes (wp-login.php variations, xmlrpc attacks) can be ignored. Focus on URLs that real humans or Google are actually trying to reach.

When do 404 errors indicate a bigger problem?

Occasional 404s are normal — content gets deleted, URLs change, external sites link to wrong paths. But patterns of 404 errors can signal deeper issues:

  • Hundreds of new 404s suddenly: Possible permalink structure corruption, .htaccess deletion, or hosting migration issue
  • 404s on URLs you never created: Possible hack (SEO spam pages that were indexed, then cleaned)
  • Intermittent 404s (page works sometimes, 404s other times): Caching issue or server resource exhaustion
  • All custom post type URLs 404: The plugin registering that CPT was deactivated or updated with a breaking change

If you are seeing patterns rather than isolated incidents, the underlying cause needs investigation beyond simple redirects. A WordPress one-time fix can diagnose and resolve systematic 404 issues when the cause is not obvious.

Frequently Asked Questions

Systematic 404 issues you cannot resolve?

We diagnose and fix complex permalink, redirect, and server configuration problems.