How to Fix WordPress 404 Not Found Error

Posted on Oct 05, 2023
How to Fix WordPress 404 Not Found Error

It’s one of the worst things that can happen if you click on a link and end up on a 404 error page. One of the most harmless error numbers on the internet is 404. It means that the page you visited wanted isn’t there. 

A “404 Not Found Error” can be annoying for both people who use the internet and people who own websites. This error shows up when the service cannot be reached.  

In this guide, we will look at why this common WordPress error happens and how to fix it step by step so that your website stays user-friendly and easy to explore.

 Understanding WordPress 404 Not Found Error

404 not found error

A “404 Not Found Error” means that the server was able to be reached, but the page in question could not be found. This error not only makes things hard for users, but it can also hurt SEO results. 

The HTTP response code 404 is displayed on the screen when the server cannot locate the web page requested by the client. There may be several underlying causes behind this technical mishap, including:

  • A typo in the entered URL.
  • Issues with file permission.
  • Webpages moved without proper redirection.
  • Broken internal links within the website.

When any of these issues happen, instead of webpage contents, you will encounter a blank page with the 404 error code. It doesn’t necessarily have to be the same 404 error message, there could be variations in the displayed message such as:

  • Error 404
  • HTTP Error 404
  • Page Not Found
  • The page cannot be found
  • 404 Page Not Found
  • The requested URL was not found
  • We can’t find the page you’re looking for

These error messages, regardless of their appearance, can be a frustrating experience for the audience. This can have a negative impact by causing a poor user experience and resulting in the loss of website visitors and if it frequently happens, your website might create a bad impression on the search engines as well. Sometimes all you have to do is try clearing the browser cache and cookies. This might help you with resolving the issue. But these errors can happen in WordPress because of issues like wrong permalink settings, deleted or broken .htaccess files, or problems with plugins and themes. Below are some common reasons and the detailed explanation on how to fix the 404 error.

1. Checking for Incorrect Permalink Settings

checking for permalinks errors

Permalinks are the permanent URLs to your individual posts, pages, and other content on your WordPress site. Incorrect permalink settings are a common culprit behind 404 errors. Navigate to “Settings” and then “Permalinks” in your WordPress dashboard to ensure the structure is correctly configured. 

If you get a “404 Not Found” error on your WordPress site, it usually means that there is a problem with your permalink settings or the way your URLs are set up. Follow these steps to check and change your permalink settings and fix this error:

  1. First, you need to Log in to your WordPress dashboard.
  2. Edit the page or post that is giving the 404 error by hovering your mouse on it and clicking the ‘Edit’ button. 
  3. Make sure the permalink is correct by clicking the ‘URL’ section and changing the slug. You can follow the same process for posts. 
changing the url slug
  1. Don’t forget to save the page or post by clicking the ‘Update’ button. 
  2. After that, go to “Settings” and select “Permalinks.”
  3. You have to choose a new permalink structure, preferably “Post name.
  4. Then save your changes.
  5. You have to test your website.
  6. Clear browser cache.
  7.  Check for broken links.
  8.  Check the .htaccess file (advanced).
  9.  Contact hosting support if needed.

2. Updating WordPress Rewrite Rules

WordPress rewrite rules define how URLs are translated into query strings. These rules are written in the .htaccess file located in your website’s root directory. Updating your rewrite rules by simply resaving your permalink settings can often resolve 404 errors. 

It’s crucial to ensure that the .htaccess file is correctly configured and writable.

If you’re encountering a “404 Not Found” error on your WordPress website, it may be due to an issue with the rewrite rules. 

Rewrite rules are essential for WordPress to properly handle URLs and route requests to the correct content. Here are steps to update WordPress rewrite rules to fix the 404 error:

  1. Log in to your WordPress admin dashboard.
  2. Go to “Settings” > “Permalinks.”
  3. Without changing anything, click the “Save Changes” button. This action flushes and regenerates the rewrite rules.
  4. WordPress typically manages to rewrite rules by modifying the .htaccess file in your website’s root directory.
  5. Ensure that your .htaccess file exists and is writable. You can set its permissions to 666 temporarily to allow changes.
  6. To regenerate the .htaccess file, you can visit the Permalinks settings page again and click “Save Changes.”
  7. If your .htaccess file is not being automatically generated or you want to try custom rewrite rules, you can manually edit it.
  8. Open the .htaccess file in a text editor or via an FTP client.
  9. Ensure it contains the default WordPress rewrite rules. Here’s an example:
updating rewrite rules
  1. Sometimes, plugins can interfere with rewrite rules. Deactivate all your plugins and see if the 404 error persists. If it disappears, reactivate your plugins one by one to identify the problematic one.
  2. Switch to a default WordPress theme (e.g., Twenty Twenty-One) temporarily to see if your theme is causing the issue. If the error goes away, you may need to investigate your theme’s code.
  3. In rare cases, server misconfigurations can lead to rewrite rule issues. Consult your hosting provider or server administrator if all else fails.
  4. If you’re using any caching plugins or server-side caching mechanisms, clear the caches after making changes to rewrite rules.
  5. After making changes, test various URLs on your site to ensure they load correctly without 404 errors.

3. Restoring .htaccess File

restoring .htaccess file

The .htaccess file is a vital configuration file used by Apache-based web servers. If this file is missing or corrupted, it may result in a 404 error. Access your website’s root directory using an FTP client and check for the .htaccess file. If it’s missing or corrupted, restore it from a backup or create a new one and set the correct file permissions.

  1. Use an FTP client (e.g., FileZilla) or your hosting provider’s file manager to access your website’s root directory.
  2. Look for the .htaccess file in the root directory of your WordPress installation. If you don’t see it, it may be hidden. Be sure your FTP client is configured to display hidden files.
.htaccess file
  1. If you have a backup of your .htaccess file (perhaps from a recent site backup), download it to your local computer.
  2. If you don’t have a backup, you can generate a new .htaccess file by going to your WordPress admin dashboard.
  3.  Log in to your WordPress admin. Go to “Settings” > “Permalinks.” Without making any changes, simply click the “Save Changes” button. This will regenerate the .htaccess file with the default WordPress rewrite rules.
  4. If you downloaded a backup in step 3, upload that backup to the root directory, replacing the existing .htaccess file.
  5. If you generated a new .htaccess file in step 4, it should already be in place.
  6. Visit your website and check if the 404 error is resolved. Try accessing various pages and posts to ensure that everything is working correctly.
  7. To confirm your custom permalinks (if you had any) are applied correctly, go to “Settings” > “Permalinks” in your WordPress admin dashboard and click “Save Changes” again.

4. Deactivating Plugins and Themes

deactivating and deleting plugins

Plugins and themes enhance the functionality and appearance of your WordPress site. However, they can sometimes conflict with each other or with WordPress itself, leading to 404 errors. Deactivate all plugins and switch to a default theme to identify the problematic element. Once identified, you can either replace it or seek a resolution from the developer.

  1. Log in to your WordPress dashboard.
  2. Deactivate plugins one by one from the “Plugins” section.
  3. Check your website for the error after each deactivation.
  4. If a plugin causes the error, consider keeping it deactivated or finding a solution.
  5. Reactivate the remaining plugins one by one and test after each activation.
  6. If the error persists, switch to a default WordPress theme temporarily from the “Themes” section.
  7. Check your website for the error with the default theme.
  8. If the error is resolved, switch back to your original theme.
  9. Clear your browser cache and any caching plugins.
  10. Refresh your permalink structure in “Settings” > “Permalinks.”
  11. If the error remains, contact your hosting provider for server-related issues.

5. Set Up 301 Redirect Link

You can set up a 301 redirect link to resolve the 404 error by redirecting the users from old URL to the new URL. This can be easily done using the Redirection Plugin.

  1. Install and activate the Redirection Plugin.
  2. Go to the WordPress Dashboard, where you will find the Redirection Option.
  3. Add the source URL (old)  and target URL (new).
  4. Save the changes and test the redirect to confirm that it is working properly.

 Conclusion

WordPress 404 Not Found Error can be a frustrating and disruptive issue for both website owners and visitors. However, armed with the knowledge and strategies outlined in this blog, you can effectively diagnose, troubleshoot, and often resolve this problem.

Remember that a 404 error is not always the result of a single underlying cause. It can stem from broken links, misconfigured settings, plugin or theme conflicts, or even server issues. Therefore, a systematic approach to problem-solving is key.

Start by clearing the browsing cache and cookies, if that does not work try checking your links and permalinks, ensuring they are accurate and up-to-date. Next, examine your plugins and themes, deactivating them one by one to identify any conflicts. Don’t forget to clear your cache and refresh your permalink structure. Finally, try setting up the 301 Redirect link.

Should these steps fail to resolve the issue, it’s essential to seek assistance from your hosting provider or a WordPress expert who can delve deeper into server-related problems.

Acowebs are the developers of the WooCommerce Deposits– Partial Payments  plugin that helps the customers pay a fixed price, percentage, partial payment, or deposits, for the products purchased from your Woocommerce store. It also has developed various other plugins like WooCommerce Currency Switcher, the multi-currency converter plugin that shows prices in the user’s local currency and helps customers connect to desired products faster. It helps customers quickly compare products and make a judgment easily.

WRITTEN BY
Rithesh Raghavan

Rithesh Raghavan, is a seasoned Digital Marketer with more than 17+ years in Digital Marketing & IT Sales. He loves to write up his thoughts on the latest trends and developments in the digital world, especially related to WordPress, Woocommerce and Digital Marketing.