wordpress 404 error

WordPress 404 Error: Common Causes and Ways to Fix Them

Being greeted with the 404 error when you visit a page is one of the experiences you’d never want to encounter. It is an embarrassing error that can waste your time in the middle of time-bound research. 

It can even be more worrying if the error occurs on your website. This is because you may end up losing hundreds if not thousands of potential clients if you don’t address the matter promptly. 

However, of all the website errors, the WordPress 404 error is quite harmless, save for its distraction. If you can fix it fast enough, you’ll never lose even a single potential client. 

Let’s delve deeper and find out what causes the 404 error and how you can fix it.

Common Causes of the 404 WordPress Error

If you are a regular internet user, then you must have come across this error. It usually pops up when your browser can not find a page you are trying to access. The message displayed will depend on your browser. The most common messages being “Page not found,” “We couldn’t find this page,” and “That page doesn’t exist.”

WordPress comes with its default message, but you can customize it to read as you wish. This may not be necessary, but it is a polite way of explaining to your visitors what’s going on or directing them to other active pages.

The WordPress 404 error can be caused by:

  •  A wrongly typed URL – If you’ve not typed the URL of the page’s content correctly, the 404 error will pop up.
  • Caching problems – If your browser cached the page, you might see the error even if the site is working fine. Just clear the cache, and your site will be up and running. 
  • A problem with your DNS (Domain Name Server) settings – This happens when the page you are trying to access has not yet been propagated to the DNS. In this case, wait until the website propagates. 
  • WordPress compatibility problems – This happens when the theme or plugin you are using affects the website permalinks. 

Mistyped URLs, caching problems, and issues to do with DNS are easier to deal with. So let’s deal with the permalink and URL issues. 

How to Fix the 404 Error?

You may not know it, but some 404 errors in WordPress disappear after some time. This mainly occurs when there’s an issue with your hosting provider. So before you start troubleshooting or fixing the 404 error, force-refresh the page. 

After doing that, wait for about 5  – 10 minutes and reload the page and see what happens. If the error disappears, then it was a minor hiccup from the server. If it persists, then there are underlying issues that need to be addressed, in which case, there are three solutions you can try one by one.

1. Reset the WordPress Permalinks

Permalinks are those permanent URLs of the pages and blog posts on a WordPress website. Basically, it’s the permalinks that your visitors use to access content on a page of your website or a blog post on your site. 

Whenever you post content, WordPress will automatically generate a permalink associated with the post. The 404 error can result from the process of the permalink creation. If the 404 error results from this process, then you can eliminate it by resetting the permalink. 

The good news is that WordPress has several options that you can use to format your pages and posts’ links. One way is to configure your platform so it can use only numeric links. Another way is to set your platform such that the URL of a post becomes similar to the post’s name.

Resetting the permalink should be your first line of action after you’ve tried force-refreshing your page, and it fails. You can reset the permalink via File Transfer Protocol (FTP) (using FileZilla) or through the dashboard if you have access to it. 

Get to the dashboard, then click on Settings, followed by Permalinks. Check your current permalink structure to know how it looks. You can then navigate to the Common Setting and select Plain and click Save. 

Your page will automatically reload. You can then choose your original permalink structure and click Save once again, and you are done. Doing that will restructure the permalink settings and flush any rewrite rules that were causing the 404 error. 

You can load your page again to find out if the error is still there. If the error is gone, well and good. If not, try the FTP  or debugger plugin route before you move to the next step. 

2. Restoring the .htaccess File

Every change you make on the permalink structure will get saved to the  .htaccess file. This file controls how the website and its server interact. It is also the same file that governs how WordPress generates URLs for content and pages. 

If the 404 error prevents you from accessing your dashboard, you’ll have to reset the permalinks by editing the  .htaccess file manually. The first step is to use FTP to access your website, then find where the root folder is. 

The root folder is a directory, which is a repository for all your WordPress installation information. You can get in a folder called www or public_html. It may also have a name similar to that of your website. 

Once you locate it, open it, then search for the  .htaccess file then right-click on it. Select the Edit/View option to download a copy of this file.  Once it is downloaded to your laptop or PC), open it in your text editor. This will enable you to make changes to it as you please. 

If you understand the code in this text, then you are better placed to edit it. If you don’t understand the code in this file, don’t worry. Just edit it, so it looks exactly like the one below:

# 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

This is how the .htaccess code should look before any error corrupts it. By rewriting it the way it is, you essentially remove any modifications that might have resulted in the 404 error by interfering with your permalink structure. 

You can now back up the old code in the .htaccess file, just in case. You can then replace the old code with the new one, save the changes to the .htaccess file,  and close the folder. Agree to the prompt asking you whether to replace the .htaccess file or not. That’s it! That’s how to reset permalinks manually, leaving everything else intact.

Once again, test your website to see if this process has worked. If successfully done, the 404 error shouldn’t appear again. You can then go ahead and restore your permalink structure the way it was unless you are comfortable with the numeric URLs.

You can easily change the structure of your permalinks by visiting the dashboard. Once you restore the original structure, everything will be back to normal, and hopefully, the WordPress 404 error will be gone. If not, try the next step below. 

3. Disabling the WordPress Plugins and Themes

Some WordPress plugins and themes can interfere with the permalink structure. It all depends on their settings. If the above two methods have failed, then it is most likely that one or more of your plugins or the theme could be the culprit. You might be surprised that disabling one or more of your plugins may eliminate this error. 

If you can access the dashboard, click Plugins then All Plugins. You can start with the first plugin. Disable it, then test the site. If the error disappears, then you are lucky. If not, move to the next plugin. Disable it, then test the website. You’ll have to do this until you identify the troublesome plugin. 

It is possible to disable all the plugins at once, but this won’t help much because it could be coming from just one plugin. Once you have identified the plugin causing the 404 error, check if it has an update, then update it and test the site again. If it has no update, you can keep it disabled until an update is made available. You can as well uninstall it and look for a suitable replacement. 

If none of your plugins is causing the error, then the problem could be coming from your theme. Go to the dashboard, click on Themes then change the active theme to another one. Test your website once again to see whether the 404 error is gone. This time around, it is most likely that it will be gone. Check if your old theme has an update, then apply it. If it has no update, you can get a new theme.  

If you can’t access the dashboard, you can handle the plugins and the theme via FTP. Use FileZilla, then look for the directory named the public_html/wp-content. You should be able to find the Plugins and Theme folders in this folder.  

When you open the themes folder, you’ll find many other folders in it. Each of these folders is for a particular plugin. You can disable a plugin by changing the name of its corresponding folder. Right-click on the folder, then select Change, then give it a new name. Close then test your website. You can restore the name of any folder you’ve tested and found to be clean. Do this for all other folders. 

If the problem persists, move to the Themes folder. Change the name and test your site. Since this is the last test, you’ll likely find the theme is the cause of the error. You can either update it or get a new theme. 

Finally 

As you can see, fixing the WordPress 404 error isn’t as difficult as you might have imagined. However, if you feel you can do it on your own, you can contact an expert, more so when it comes to changing codes.

See also some of the Articles Fixing common errors on WordPress:

Leave a Comment

Your email address will not be published. Required fields are marked *