How to Fix the WordPress 404 Not Found Error

How to Fix the WordPress 404 Not Found Error thumbnail

You’ve likely seen the “Page Not Found” error before.

Unfortunately, if you operate a website of any sort (WordPress or not), the day will probably come when you see the message on one of your own pages.

Fortunately, like many common WordPress errors, 404s are relatively easy to troubleshoot and fix. The solution usually involves restoring your site’s permalink structure — something you can do in just a few minutes.

In this article, we’ll explain just what a 404 error is and what can cause one on your site. Then, we’ll walk you through how to fix it in four simple steps.

Let’s get started!

An Overview Of The WordPress 404 Error

A 404 error, also known as a “Page Not Found” error, indicates that your browser can’t locate the page you’re trying to access.

The exact message can look a bit different depending on the browser you’re using, but it will generally always contain either the “404” code or a “page not found” message of some kind.

Website owners can also create their own custom 404 Not Found pages. For example, here’s what our (very cool, we might add) 404 page looks like:

404 Error Message

Seeing this notification (or any other error message) when trying to access your site can be frustrating. While there is a chance that your post has actually gone missing, the vast majority of the time, there’s a more benign cause.

Some common reasons WordPress posts might return 404 errors include:

  • A mistyped URL – It could simply be attributed to a typo in the URL. This is the most common cause.
  • An issue with your Domain Name System (DNS) settings – If you’ve recently updated any of your DNS information and see this error, it could be because the changes haven’t propagated fully. It can take up to 48 hours for this process to complete.
  • Problems with add-ons or the structure of your site – WordPress permalink problems can be caused by a missing, broken, or corrupted .htaccess PHP file. Compatibility issues with WordPress components, such as plugins and themes, could also be the culprit.
DreamHost Glossary

DNS

The Domain Name System (DNS) protocol keeps records of which domain names correspond to specific IP addresses. This system enables you to browse the web by typing in regular URLs instead of IP addresses.

Read More

Regardless of the cause, this error prevents access to your site and can scare off users and potential customers. So, it needs to be resolved as quickly as possible. This is why, shortly, we’ll walk through troubleshooting and resolving the most common causes behind the WordPress 404 error.

Get Content Delivered Straight to Your Inbox

Subscribe to our blog and receive great content just like this delivered straight to your inbox.

Why 404 Errors Matter

404 errors pose several problems for a website beyond simply preventing you from accessing pages.

First, they create a poor user experience (UX).

When you land on a page that doesn’t have what you were looking for — or much of anything for that matter — what do you do?

You leave. Go back to the search engine — And possibly avoid clicking on anything from that site again due to lack of trust.

If there are even a few of these errors on your site, they can absolutely turn away users (and potential buyers.)

In the worst-case scenario, those visitors could land on a competing website instead, costing you business.

Additionally, 404 errors can also hurt your search engine optimization (SEO). Search engine crawlers won’t index a page that returns a 404 because they think it doesn’t exist.

Get enough of these non-existent pages on your website, and you’ll start training search engines that your site is full of low-value content. You’ll begin to trail after your competitors in the search engine results pages (SERPs).

This matters because SEO is the primary driver of traffic to websites.

SEO Accounts For Majority of Website Traffic

What To Do *Before* Troubleshooting The WordPress 404 Error

Worried about scaring off leads and search engines?

We’re here to help — but don’t do anything in a rush!

Just before you dive into changing your permalink settings or accessing your .htaccess file, it’s a smart idea to create a backup of your website and database. This way, if you accidentally make something worse, you can easily restore your site to a functioning state.

If your WordPress website is hosted with DreamHost, backups couldn’t be easier.

We offer easy one-click backups for every customer. And with one of our managed WordPress hosting plans, daily backups are automatic — so you’ll always have a fresh copy to access.

You can also create a manual backup by following our guide to How to Back Up Your WordPress Website.

 

Related: How to Choose a Web Hosting Provider — 15-Point Checklist

How To Fix WordPress Posts Returning 404 Error (4 Steps)

With a fresh backup of your site in hand, it’s time to get to work solving your problem.

Tip: The best way to navigate this step-by-step guide is to follow it in order, enacting each change in order and checking if the error has been resolved after each one.

Step 1: Reset Your WordPress Permalinks

The first step to try is resetting your permalinks.

Head to your WordPress dashboard and navigate to Settings > Permalinks.

Permalinks

From here, just click on Save Changes at the bottom of the screen.

Seriously, that’s it.

You don’t actually need to edit anything. Clicking that button will update the permalink settings even if you don’t make any changes. This is important because it also refreshes the rewrite rules used for “pretty permalinks.” Without these rules that resolve pretty permalinks, any pages that use them would display the 404 Page Not found error.

With this done, go ahead and reload the pages you were trying to access. If everything works, you’re all done!

If you still get a 404 error, head to the next step.

Step 2: Restore Your .htaccess File

If resetting your permalinks didn’t work, the next strategy is restoring your .htaccess file. This controls how WordPress interacts with the web server and how it generates permalinks for your pages. Restoring it to the default settings can fix sudden 404 errors.

DreamHost Glossary

.htaccess

'.htaccess' is a configuration file used by the Apache web server software. The .htaccess file contains directives (instructions) that tell Apache how to behave for a particular website or directory.

Read More

To restore the .htaccess file, you’ll need to open it up and make some simple edits. There are a few ways to do this.

You can use a Secure File Transfer Protocol (SFTP) client, such as FileZilla. We have detailed instructions for connecting via SFTP if you need help.

If you’re using DreamHost, you can use the built-in file manager. This guide from our knowledge base will walk you through accessing and utilizing the DreamHost file manager.

Once you have the file manager open, select the folder that corresponds to your domain name. You’ll find the .htaccess file inside (if you see items such as “wp-content,” you’re in the right place!)

Just in case anything goes wrong, first copy the current contents of the .htaccess file and paste them somewhere for safekeeping.

Then, replace the contents of the .htaccess file with the following:

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

This is the default .htaccess code for WordPress. Once you’ve pasted this in and saved your changes, your restoration is almost complete!

We say almost because restoring this file will also reset the permalink settings for your WordPress site. Therefore, if you’re using a custom permalink structure (or have changed it at all from the default), you now need to restore those settings.

To do so, head back to your WordPress dashboard and navigate to Settings > Permalinks (just like step 1 above). Restore your preferred settings then Save Changes.

Finally, refresh your website and attempt to load the pages that were returning 404 errors.

If everything works now, congratulations!

If not, proceed again to the next step.

Step 3: Disable Your WordPress Plugins And Theme

If you’ve reset your permalinks and .htaccess file but you’re still seeing 404 errors on your site, the next step is to check your WordPress theme and plugins.

Plugins, in particular, can sometimes have bugs or compatibility issues that prevent a site from loading.

So, let’s start there.

The basic idea is to disable them one by one, checking on those 404s each time. If the error persists, turn it back on and move to the next one.

To get started, head to your WordPress dashboard and navigate to Plugins > Installed Plugins.

Installed Plugins

Locate and click the Deactivate button associated with the top active plugin on the screen. (Active plugins should have a blue background. Inactive ones should have a white background and no option to deactivate.)

Deactivate

Now, refresh your site and see if the 404 error is still occurring.

If you get the dreaded error message, head back to the plugins, re-activate the one you just tried, and move to the next active one on the list.

If you find one that resolves the issue, you can check if the plugin has an update that may resolve the problem. If updating it and then refreshing one more time doesn’t work, look for an alternative plugin with similar functionality.

But if none of the plugins prove to be the issue, it’s time to try changing your WordPress theme.

To do that, head to Appearance > Themes.

How To Use WordPress Theme Editor, Choose Your Theme

Your currently-active theme is marked as such. Hover over one of the others and click on Activate. Then, refresh your site and try to access the problematic page again.

Note that changing your theme can alter your site significantly. Additionally, if you’ve made any edits to your theme, those can be lost if your theme is changed or even updated. So, again, spend some time backing up your site before you go clicking around inside your themes.

If you end up finding that it’s your theme that’s the issue, you may need to spend some time finding one that provides a similar look and features.

Need help? Check out 18 Pro Tips For Choosing The Perfect WordPress Theme.

Step 4 (Bonus): Set Up A 301 Redirect For Moved Content

Just in case you do need to move content to a new URL and don’t want the old one to throw a 404 error, here’s one final step.

You’ll want to set up some 301 redirects to point that old URL to the new one.

The easiest way to do this is with the Redirection plugin. This tool will enable you to quickly set up the redirects you need. Plus, it’s free and user-friendly.

Related: How to Fix the “Too Many Redirects” Error in WordPress (13 Methods)

How To Create Your Own “Error 404 Not Found” Page

If you want to set up your own custom 404 error page, you can do so relatively easily.

The 404page plugin is a very popular option for quickly creating a custom error page.

Or, you can take a more hands-on approach and do it manually. This is still pretty simple and only requires adding one line of code to the .htaccess file (accessed via your file manager, like in step 2 above) to target the error to a specific page. Then, you just have to create that new page.

We have full instructions for setting up custom error pages to walk you through the process.

Tools To Help You Monitor 404 Errors Moving Forward

Finally, if you want to keep an eye out for 404 errors in the future, you can do so with a few handy tools.

If you’re using Google Analytics to understand website traffic, you can also use it to find 404 errors on your site. Databox has a guide on how.

Google Search Console will also show you crawl errors that the Google bots have come across as they indexed your site. This is a simple way to see all the issues Google is encountering.

You can also enter your URL into a specialized tool such as the Broken Link Checker, which will scan your entire site for broken links and let you know if it finds a 404 page. It’s free and easy to use.

More WordPress Error Tutorials

Want to learn how to fix other common WordPress errors? We’ve created a robust series of guides to help!

Check ‘em out:

Let Us Handle Those WordPress 404 Errors

A 404 error can be frustrating — especially when it happens on your own site.

These messages cause problems with SEO and ruin your site’s UX. Fortunately, they’re not too difficult to resolve.

Fixing 404 web pages generally involves restoring your site’s permalink structure and setting up redirects for any posts that are actually gone. You can then use tools, such as Google Search Console, to monitor your site for future 404s.

If you want to spend less time dealing with errors, consider switching to managed WordPress hosting from DreamHost.

You can engage our Development Pro Services teams on a retainer or on-demand basis to take website management off your page, so you can get back to business!

Skip the Stress

Avoid troubleshooting when you sign up for DreamPress. Our friendly WordPress experts are available 24/7 to help solve website problems — big or small.

Managed WordPress Hosting - DreamPress
Photo of Jos Velasco
About the Author:

Jos Velasco is a WordPress Professional Consultant at DreamHost. His responsibilities include helping with advanced WordPress cases, creating training material, and identifying trends impacting the WordPress community. In his free time, he enjoys climbing mountains, eating healthy, and watching drama movies. Follow Jos on LinkedIn: https://www.linkedin.com/in/josvelasco/