Skip to content

How to Fix 404 Error in WordPress

A 404 error in WordPress means a page can’t be found. This guide walks you through practical, beginner-friendly fixes—from refreshing permalinks to checking theme files—so your visitors never hit a dead end again.

Key Takeaways

  • Refresh your permalinks: Often, simply resaving permalink settings resolves 404 errors caused by outdated URL structures.
  • Check your .htaccess file: A corrupted or missing .htaccess file can break page routing—restore it with default WordPress rules.
  • Verify theme and plugin conflicts: Deactivate plugins or switch to a default theme like Twenty Twenty-Four to isolate the issue.
  • Ensure correct file permissions: Incorrect server file permissions may prevent WordPress from accessing necessary files.
  • Use a custom 404 page: Improve user experience by creating a helpful, branded 404 page that guides visitors back to content.
  • Monitor broken links regularly: Use tools or plugins to catch and fix broken links before users encounter them.

What Is a 404 Error in WordPress?

A 404 error is one of the most common—and frustrating—issues WordPress site owners face. When someone clicks a link or types a URL and sees “404 Not Found,” it means the page they’re trying to reach doesn’t exist on your server. This could happen for many reasons: a deleted post, a changed permalink structure, or even a simple typo in the URL.

While occasional 404s are normal (like when content is removed), frequent or widespread 404 errors hurt your site’s credibility, SEO, and user experience. The good news? Most 404 errors in WordPress are easy to fix with a few targeted steps.

In this guide, you’ll learn how to fix 404 error in WordPress using proven methods—from quick permalink refreshes to deeper server-level checks. Whether you’re a beginner or an experienced developer, these solutions will help keep your site running smoothly.

Step 1: Refresh Your Permalink Settings

The most common fix for WordPress 404 errors is refreshing your permalink structure. WordPress uses permalinks to map URLs to your content. If these get out of sync—especially after migrating your site or updating settings—pages may return 404 errors.

How to Reset Permalinks

  1. Log in to your WordPress dashboard.
  2. Go to Settings > Permalinks.
  3. Without changing anything, click Save Changes at the bottom.

This action regenerates the rewrite rules in your .htaccess file, which often resolves missing pages. After saving, try accessing the problematic URL again. In most cases, this simple step fixes the issue.

Pro Tip: If you recently migrated your site or changed hosting, always reset permalinks as part of your post-migration checklist.

Step 2: Check and Repair the .htaccess File

The .htaccess file controls how URLs are processed on Apache servers. If this file is missing, corrupted, or misconfigured, WordPress can’t route requests properly—leading to 404 errors.

How to Fix 404 Error in WordPress

Visual guide about How to Fix 404 Error in WordPress

Image source: blog.templatetoaster.com

Locate Your .htaccess File

The .htaccess file is usually found in the root directory of your WordPress installation (the same folder that contains wp-config.php). If you don’t see it, make sure your FTP client or file manager is set to show hidden files (files starting with a dot are hidden by default).

Restore Default WordPress Rules

If the file exists but looks wrong, or if you’re unsure, replace its contents with the standard WordPress rules:

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

Save the file and upload it back to your server. Then test your site again. This often resolves 404 issues caused by rewrite rule problems.

Note: If you’re on NGINX instead of Apache, .htaccess doesn’t apply. You’ll need to update your server configuration file with equivalent rewrite rules.

Step 3: Deactivate Plugins and Switch Themes

Sometimes, a plugin or theme conflict causes 404 errors—especially if the error started after installing new software or updating existing components.

Test for Plugin Conflicts

  1. Go to Plugins > Installed Plugins.
  2. Deactivate all plugins at once.
  3. Check if the 404 error is gone.
  4. If fixed, reactivate plugins one by one, testing after each, to identify the culprit.

Switch to a Default Theme

If plugins aren’t the issue, your active theme might be causing problems—especially if it has custom rewrite rules or broken template files.

  1. Go to Appearance > Themes.
  2. Activate a default WordPress theme like Twenty Twenty-Four.
  3. Test the problematic URL again.

If the error disappears, the issue lies with your original theme. You can either fix the theme’s code or consider using a different one. For help managing themes safely, check out our guide on how to deactivate a theme in WordPress or learn how to set a default theme in WordPress for testing.

Step 4: Verify File and Folder Permissions

Incorrect file permissions on your server can prevent WordPress from reading or executing necessary files, resulting in 404 errors—especially for dynamic pages.

Recommended Permissions

  • Folders: 755
  • Files: 644
  • wp-config.php: 600 or 644 (for security)

Use your FTP client or hosting file manager to check and adjust permissions. Most hosts allow you to right-click a file or folder and select “File Permissions” or “CHMOD.”

Warning: Avoid setting permissions to 777—it’s a security risk and often unnecessary.

Step 5: Check for Missing or Moved Content

Sometimes, the content itself is missing. A post, page, or media file might have been accidentally deleted, moved, or renamed—especially after bulk operations or migrations.

Search Your Content

  • Go to Posts > All Posts or Pages > All Pages.
  • Use the search bar to look for the missing page by title or slug.
  • If found, check its status—ensure it’s published, not draft or trash.

If the content is truly gone, you may need to restore it from a backup or recreate it. Always keep regular backups to avoid permanent data loss.

Step 6: Create a Custom 404 Page

Even after fixing the root cause, some 404s will still happen—users mistype URLs, external sites link to old pages, etc. Instead of showing a generic error, create a helpful custom 404 page.

How to Add a Custom 404 Page

  1. Go to Appearance > Theme File Editor (or use FTP).
  2. Look for a file named 404.php in your theme folder.
  3. If it doesn’t exist, create one based on your theme’s structure.
  4. Add friendly text, a search bar, and links to popular pages.

Example content for 404.php:

<h1>Oops! Page Not Found</h1>
<p>We can't find what you're looking for. Try searching or visit our <a href="/">homepage</a>.</p>
<?php get_search_form(); ?>

A well-designed 404 page reduces bounce rates and keeps visitors engaged. For more on theme customization, explore our guide on what is a child theme in WordPress to safely modify templates.

Troubleshooting Persistent 404 Errors

If you’ve tried all the above and still see 404s, consider these advanced checks:

  • Check your site’s URL settings: Go to Settings > General and ensure “WordPress Address” and “Site Address” are correct.
  • Review server error logs: Contact your host or check cPanel for error logs that might reveal deeper issues.
  • Test with a different browser or device: Rule out local caching or browser-specific problems.
  • Use a broken link checker: Tools like fix broken links in WordPress without plugin can help identify and resolve lingering issues.

Conclusion

Encountering a 404 error in WordPress doesn’t have to be a crisis. With the right approach—starting with permalinks, checking .htaccess, testing themes and plugins, and verifying content—you can resolve most issues quickly. And by creating a helpful custom 404 page, you turn a potential frustration into a positive user experience.

Remember: regular maintenance, backups, and monitoring go a long way in preventing 404 errors before they happen. Keep your site healthy, and your visitors will stay happy.