How to Fix 404 Errors in WordPress: 8 Proven Solutions

the screenshot of code when 404 error happens

A 404 error means WordPress can’t find the page a visitor requested. This guide covers the most common causes and step-by-step solutions to fix 404 errors on your WordPress site quickly.

Quick Fix Checklist

Try these fixes in order – most 404 errors resolve with the first two steps:

  1. Reset permalinks – Settings → Permalinks → Save Changes (90% of cases)
  2. Clear cache – Purge browser cache and any caching plugins
  3. Check .htaccess file – Restore default WordPress rules
  4. Deactivate plugins – Test for conflicts one by one
  5. Switch theme – Try a default theme temporarily
  6. Check file permissions – Folders: 755, Files: 644
  7. Set up redirects – For moved or deleted content
  8. Contact hosting – If server configuration is the issue

Common Causes of WordPress 404 Errors

Understanding why 404 errors occur helps you fix them faster:

  • Corrupted .htaccess file – Most common cause on Apache servers
  • Permalink settings reset – Often after updates or migrations
  • Plugin or theme conflicts – Interfere with URL routing
  • Deleted or moved content – Pages or posts no longer exist at that URL
  • URL typos – Incorrect links in content or navigation
  • Caching issues – Old URLs served from cache
  • Server misconfiguration – mod_rewrite disabled or Nginx rules missing
  • DNS propagation – After domain changes or new registrations

🌊 Too busy to manage your WordPress site? Our expert team handles all your website needs – from fixes to improvements – while you focus on running your business. Start with our WordPress retainer service →

This fix works in approximately 90% of WordPress 404 error cases. It regenerates the .htaccess file with correct rewrite rules.

  1. Log in to your WordPress admin dashboard
  2. Go to Settings → Permalinks
  3. Don’t change anything – just click Save Changes
  4. Test the affected pages

This forces WordPress to flush and regenerate the permalink structure and .htaccess rules.

If that doesn’t work:

  1. Note your current permalink setting
  2. Select Plain and click Save Changes
  3. Change back to your original setting and Save again
  4. Test the pages

Solution 2: Fix or Restore the .htaccess File

The .htaccess file controls how WordPress handles URLs. A corrupted or missing file causes site-wide 404 errors.

Check If .htaccess Exists

  1. Access your site via FTP or File Manager in your hosting panel
  2. Navigate to the WordPress root directory (where wp-config.php is)
  3. Look for .htaccess (enable “show hidden files” if you don’t see it)

Restore Default WordPress .htaccess

If the file is missing or corrupted, create a new one with this default content:

# 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

For WordPress in a subdirectory (e.g., example.com/blog/), adjust RewriteBase:

RewriteBase /blog/

File permissions: Set .htaccess to 644 (readable by all, writable by owner only).

For Nginx Servers

Nginx doesn’t use .htaccess. If your site runs on Nginx and you’re getting 404 errors, check your server configuration. Add this to your Nginx server block:

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

Contact your hosting provider if you’re unsure about Nginx configuration.

Solution 3: Clear All Caches

Caching can serve old 404 errors even after you’ve fixed the underlying issue.

Browser Cache

  • Chrome: Ctrl+Shift+Delete (Windows) or Cmd+Shift+Delete (Mac)
  • Firefox: Ctrl+Shift+Delete
  • Safari: Develop → Empty Caches
  • Or test in Incognito/Private mode

WordPress Caching Plugins

Clear cache in your caching plugin:

  • WP Super Cache: Settings → WP Super Cache → Delete Cache
  • W3 Total Cache: Performance → Dashboard → Empty All Caches
  • WP Rocket: Settings → WP Rocket → Clear Cache
  • LiteSpeed Cache: LiteSpeed Cache → Toolbox → Purge All

Server-Level Cache

  • Managed WordPress hosts: Usually have a “Purge Cache” option in the dashboard
  • Cloudflare: Caching → Configuration → Purge Everything
  • Varnish: Contact your host or use a purge plugin

Solution 4: Check for Plugin Conflicts

Plugins can interfere with WordPress URL handling, especially plugins that:

  • Register custom post types or taxonomies
  • Modify permalink structures
  • Handle redirections
  • Add security restrictions

Test for Plugin Conflicts

  1. Backup your site before making changes
  2. Go to Plugins → Installed Plugins
  3. Deactivate all plugins using bulk actions
  4. Check if the 404 error is resolved
  5. Reactivate plugins one by one, testing after each
  6. When the error returns, you’ve found the problematic plugin

Can’t access admin? Rename the plugins folder via FTP:

  1. Navigate to wp-content/
  2. Rename “plugins” to “plugins-disabled”
  3. This deactivates all plugins
  4. Rename back to “plugins” after testing

Solution 5: Switch to Default Theme

Themes can also cause 404 errors, especially those with custom post types, complex routing, or outdated code.

  1. Go to Appearance → Themes
  2. Activate a default theme (Twenty Twenty-Four or similar)
  3. Test the affected pages
  4. If the error is resolved, contact your theme developer

Can’t access admin? Rename your theme folder via FTP:

  1. Navigate to wp-content/themes/
  2. Rename your active theme’s folder
  3. WordPress will fall back to a default theme

Solution 6: Set Up 301 Redirects

If content has been moved or deleted, set up redirects to send visitors (and search engines) to the new location.

Using Redirection Plugin

The Redirection plugin is the most popular free option:

  1. Install and activate the Redirection plugin
  2. Go to Tools → Redirection
  3. Click Add New
  4. Source URL: Enter the 404 URL
  5. Target URL: Enter the new working URL
  6. Click Add Redirect
Redirection plugin interface for adding 301 redirects

The plugin also logs 404 errors automatically, helping you find and fix broken links.

Using Yoast SEO or Rank Math

Both SEO plugins include redirect managers:

  • Yoast SEO Premium: SEO → Redirects
  • Rank Math: Rank Math → Redirections (free version)

Solution 7: Check File Permissions

Incorrect file permissions can prevent WordPress from reading essential files.

Correct WordPress permissions:

  • Folders: 755 (drwxr-xr-x)
  • Files: 644 (-rw-r–r–)
  • wp-config.php: 640 or 600 for extra security

You can fix permissions via FTP client or your hosting file manager. Most hosts also offer a “Fix Permissions” tool.

Solution 8: Check DNS Configuration

If you recently changed domains, hosting providers, or DNS settings, incomplete propagation can cause 404 errors.

  • DNS propagation can take 24-48 hours globally
  • Check propagation status at dnschecker.org
  • Flush local DNS: ipconfig /flushdns (Windows) or sudo dscacheutil -flushcache (Mac)

Also verify WordPress Address and Site Address in Settings → General match your actual domain.

How to Find 404 Errors on Your Site

Google Search Console

The best way to monitor 404 errors over time:

  1. Open Google Search Console
  2. Go to Pages in the left menu
  3. Look under “Why pages aren’t indexed”
  4. Click Not found (404) to see affected URLs

GSC shows 404 errors that Google encountered while crawling your site, including URLs linked from other sites.

The Broken Link Checker plugin scans your site for broken internal and external links:

  1. Install and activate the plugin
  2. Go to Tools → Broken Links
  3. Wait for the initial scan to complete
  4. Review and fix broken links directly from the dashboard

Note: This plugin can impact performance on large sites. Consider running scans during low-traffic periods.

The free W3C Link Checker scans your site externally without installing anything. Enter your URL and it will crawl your pages looking for broken links.

Understanding Soft 404 Errors

A soft 404 occurs when a page displays “not found” content but returns a 200 (success) HTTP status code instead of 404. Google treats these as errors in Search Console.

Common causes:

  • Empty search results pages
  • Pages with minimal content
  • Broken JavaScript preventing content load
  • Database connection issues

Fix: Ensure your 404 template returns the correct 404 status code. Add to your 404.php template:

<?php
header("HTTP/1.1 404 Not Found");
status_header(404);
?>

Why 404 Errors Matter for SEO

404 errors themselves aren’t a ranking factor, but they can indirectly hurt your SEO:

  • Lost link equity – Backlinks to 404 pages don’t pass value
  • Crawl budget waste – Googlebot spends time on dead pages
  • Poor user experience – Increases bounce rate and frustration
  • Broken internal linking – Disrupts site architecture

Fix 404 errors promptly, especially for pages that had backlinks or significant traffic. Use our guide on whether 404 errors are bad for SEO for more context.

FAQ

Why am I getting 404 errors on all pages except the homepage?

This almost always indicates a permalink or .htaccess issue. Reset permalinks first (Settings → Permalinks → Save Changes). If that doesn’t work, restore the default .htaccess file.

The 404 error appeared after updating WordPress or a plugin. What should I do?

First, reset permalinks. If that doesn’t help, the update may have caused a conflict. Try rolling back the update using a backup, or deactivate the updated plugin to confirm it’s the cause.

Should I always redirect 404 pages?

No. Only redirect if there’s a relevant replacement page. Redirecting everything to the homepage is bad practice. If content no longer exists and has no equivalent, a 404 is the correct response.

My hosting provider can’t help. What next?

Consider hiring a WordPress developer or web maintenance service who can diagnose server-level issues, check error logs, and identify the root cause.

How can I prevent 404 errors in the future?

  • Set up automatic redirects when changing URLs
  • Use consistent URL structures
  • Check Google Search Console regularly
  • Create a helpful custom 404 page
  • Keep WordPress, themes, and plugins updated
  • Test after every major update

Need expert WordPress support?

Whether it's custom development, performance issues, or ongoing maintenance—we've got you covered. Let's talk about keeping your WordPress site running at its best.

Book a Discovery Call