How to Fix 404 Error Page on WordPress

by Saud Razzak  January 11, 2017

Not usually do you come across the WordPress 404 error on your WordPress website if it maintained effectively. But, there are times when your website is under maintenance and your visitors will be automatically directed to a 404 error page.

Fix 404 Error Page on WordPress

So is your website observing the 404 error? Don’t freak out, we have just the solution for you. It usually occurs when a user clicks on a link to a missing page, the web server will automatically send the user an error message, for example, 404 Not Found. Your website by default has composed custom error messages that are in plain content. This leaves your visitors a slightly lost.

Today, I am going to educate individuals on how they can easily resolve WordPress 404 error on their WordPress websites.

WordPress 404 Error on All Pages Except Homepage

At times, all your WordPress website pages gives you 404 page not found error except your homepage. In such a situation, you can follow these steps to resolve the issue.

  • Login to your WordPress Dashboard.
  • From the left-hand navigation menu in WordPress, click Settings > Permalinks (Note the current setting. If you are utilizing a custom structure, copy or save the custom structure place.)
  • After that, you need to Select the Default setting.
  • Save your changes.
  • Change the settings back to the previous configuration (the once you selected before Default). Put the custom structure back if you had one.
  • Click Save Settings.

Setting Permalinks

In certain cases, this solution fixes the WordPress posts 404 error. However, if it does not work for you, you’ll need to edit the .htaccess file in the main directory (where the main index.php file resides) of your WordPress installation. 404 errors are also usually due to misconfigured .htaccess file or file permission related issues.

WordPress 404 Error After Changing Permalinks

.htaccess is a hidden file, so you must set all files as visible in your FTP.

First thing first, Login to your server using FTP, download .htaccess file which is located in the same location where folders like /wp-content/ wp-admin /wp-includes/ are located.

Next, open this file in the text editor of your choice.

Visit the following link: https://codex.wordpress.org/htaccess and copy – paste the version of the code that is most suitable for your website. Save the .htaccess file and upload it to the live server.

htaccess file

For example, if you have Basic WP use the code below.

How to Fix WordPress 404 Error on Internet Explorer for Your Website

Sometimes, your WordPress website is working fine on different web browsers except Internet Explorer. This is because, IE is ignoring the 404 condition since the dawn of IE. However, a few weeks back, Microsoft introduced a system update for IE7 & IE8 that can result in stopping the 404 error occurring on your website instantly, even if your website sends valid content back.

Not Found

The solution is simple. You will have to put the code in header.php which is located in your theme folder.

header(‘HTTP/1.1 200 OK’);

Change and Update WordPress URL in Database for Preventing 404 Error

Suppose you can see the below error on your WordPress website.

“The requested URL was not found on this server. If you entered the URL manually, please check your spelling and try again.”

404 Page not found

If such a situation occurs, you can go to your PHPMyAdmin, then navigate to your database name and select wp-option, for example, blog >> wp-option.

WP-Option Database

Now change the URL like your website URL is https://www.abc.com/blog/ replace it to http://localhost/blog.

Database URL

How to Fix WordPress 404 Error on Local Servers

Many designers and developers install WordPress on their desktops and laptops using a local server for staging purposes. A common problem that mostly encounter with local server installations of WordPress is that they couldn’t get permalink rewrite rules to work.They try to change the permalinks for post and pages but eventually the website shows the “page not found” error.

In this situation, you need to turn on rewrite module in your WAMP, XAMPP, or MAMP installation. For the purpose of this tutorial, I am using WAMP. Navigate to the taskbar and find WAMP icon. After that navigate to Apache » Apache modules.

Apache modules

It will enable a long list of modules that you can toggle on and off. Find the one called “rewrite_module” and click it so that it is checked.

Rewrite Module

Then check out your permalinks again whether they are working fine or not.

Alternative Method

You can also use the alternative method. Navigate to the local server. Find the Apache folder, then go to the “conf” folder. Navigate to httpd.conf file. Search for a line which looks like:

#LoadModule rewrite_module modules/mod_rewrite.so

Just remove the #sign. So it looks like this:

LoadModule rewrite_module modules/mod_rewrite.so

Concluding Thoughts

We hope you found this guide helpful and that you were able to solve your “WordPress 404 error” problem. Have you figured out any other way to get rid of this problem? Please share your solutions with us in the provided comment section below. I am sure, it will be beneficial for others who are facing similar issues.

 

Make Your WordPress Website 100% Faster.

Host it now on Cloudways WordPress Hosting Platform.

About Saud Razzak

Saud is the WordPress Community Manager at Cloudways - A Managed WooCommerce Hosting Platform. Saud is responsible for creating buzz, spread knowledge, and educate the people about WordPress in the Community around the globe. In his free time, he likes to play cricket and learn new things on the Internet. You can email him at m.saud@cloudways.com

Stay Connected:

You Might Also Like...