Fix 404 Error Code of WordPress Website Immediately

404 error page

What is a 404 Error?

When you try to access a link on the web or visit a site, you’re telling a server located somewhere to send you a page. For example, when you go to Alibaba.com, you’re telling the Alibaba server that you want to see their home page. 

This is called a request and this type of request is primarily sent by the browser that you use to open the website. The server then responds to the browser’s request by sending you back a page. And this system of communication is known as HTTP. If the server cannot respond to the browser’s request, you will see a 404 HTTP error. You also can see…

  • 404 Not Found Error
  • 404 HTTP 404
  • 404 Page Not Found
  • Error 404 Not Found
  • HTTP 404 Not Found
  • The requested URL was not found on this server
  • 404 File or Directory Not Found 

These are all Same. Don’t worry about the different Error Massage. So follow till the end of this post and fix the 404 error.

Also Learn – How To add hreflang Tag to a WordPress and Blogger Website.

When 404 error occurs?

There are several reasons why you’re getting an HTTP 404 code_

  1. When the website owner changes the web server Address.
  2. One typical trigger for an error 404 message is when the page has been deleted from the website.
  3. The page was moved to another URL and the redirection was done incorrectly.
  4. You entered an incorrect URL address.
  5. Although it happens very rarely, sometimes the server malfunctions.
  6. The entered domain name doesn’t exist anymore. 

How to Fix 404 Error?

There are several options for fixing the 404 Server issue. Here we are discussing the 1st option above. If you are a website owner and you have recently changed the web hosting server or nameserver of the hosting, then you can probably see this 404 error. This is not a different issue. You can fix it in two simple methods.

First one

Login to your WordPress admin panel. Then Go to settings > Go to Permalinks  > Then Click on the below Save change button. That’s it. Now check the URL or website Again. If it works then fine. If not work then follow the next methods.

Second One

Open the Cpanel of your website. Then click on File Manager. Open the domain of the website. Now click on Public_html Folder. Check .htaccess file is available or not. If available then edit the folder and replace the code given below.  If not available then click on the +File left top corner of the page. Write .htaccess as a file name and click on Create on the new file. Now edit the file > paste the code > click on save the change. Congrats you have already done it. Now check your website URL again. I hope it’s running quite well.

For Single site

# BEGIN WordPress

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Multisite

If you activated Multisite on WordPress 3.5 or later, use one of these.

Subfolder Example:

# BEGIN WordPress Multisite
# Using subfolder network type: https://wordpress.org/support/article/htaccess/#multisite

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

# END WordPress Multisite

Subdomain  Example:

# BEGIN WordPress Multisite
# Using subdomain network type: https://wordpress.org/support/article/htaccess/#multisite

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

# END WordPress Multisite

You Can use Redirections WordPress Plugin to redirect changed or deleted page URLs. These plugins are simple and easy to use. You can check it.

Thanks for Visiting.

2 thoughts on “Fix 404 Error Code of WordPress Website Immediately”

  1. Thanks , I’ve recently been searching for information about this
    subject for a while and yours is the best I have came
    upon till now. However, what about the conclusion? Are you sure in regards to the source?

Leave a Comment

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

Scroll to Top