Ample Themes

Free & Premium WordPress Themes

how to fix error 404 in wordpress website in 2020

How To Fix Error 404 in WordPress Website In 2020

 

Introduction

Anyone who has used a browser to surf the Net will have at least once come across a page with a message such as ” Error 404 – Page not Found ” ( Error 404 – Page not found ). In this article, we will try to understand How To Fix Error 404 in WordPress Website In 2020.

 

What does “Error 404 Page not found” mean?

The error code 404 – Page not found is part of the category of HTTP 4xx status codes ( client errors ) that are shown in the browser if an error occurs that is not exclusively attributable to a server problem, but could be been generated as a result of a certain user action.

Of this class of errors, the 404 is certainly the best known and occurs every time a user tries to access a web page (or another type of online resource) which, currently, does not exist at the specific address where you are connected.

The reasons for encountering 404 error are varied:

  • it may happen, trivially, to incorrectly type the address of the resource we are interested in (for example due to a typing error);
  • or it may happen that a certain resource, which was reachable in the past, has been moved to a new address or removed.

In rarer cases, the 404 error is generated if it is not possible to complete the resolution of domain names to IP addresses by the DNS or in case of server-side problems. Regardless of the triggering cause, however, it should be emphasized again that the 404 error is generated every time a certain resource requested by the user (which can be an HTML page, a CSS or Javascript file, an image, or some other type file) is not currently available at the specified address.

 

What happens in the event of a 404 error

how to fix error 404 in wordpress website in 2020

According to what was said in the previous paragraph, every time a resource not available on the server is requested, the client displays a 404 error page. This error page, most of the time, is a page that is customized by the Webmaster of the site to explicitly explain that an error has occurred and to provide the user with valid alternatives to remain within the website that is visiting.

Continue after the ad …

 

Computer courses online-Learning with an online tutor and final certificate. Sign up for courses now!

Secretary 24h / 24. Try for free save 90% of your office fixed costs by using a virtual secretary.

Looking for WordPress hosting? Try SiteGround and you will fall in love. Super fast, easy, and safe.

If the webmaster of the site has not created and set a custom 404 error page, the default error page set in the web-server will be shown. Let’s see them below:

Now let’s take a closer look at what happens inside a browser when a missing page is requested and a 404 error is encountered. To carry out our test we will try to connect to a non-existent page of the NPN site. So let’s try to access a URL like this:

https://www.npmjs.com/package/dfasdfasdfs

By typing this address we will get this page:

As it was easy to assume, what we see is an error page that informs us that the package we are looking for has not been found. If we also open the Network panel of the developer console of our browser, we can examine the header of the HTTP response message and notice that there is a Status Code field, with a value of 404, which signals to the browser that the ‘ HTTP 404 error.

Alternatively, we can obtain the same information by typing, via the command line, the command curl with the flag ‘-I’ to retrieve only the header of the message.

curl -I https://www.npmjs.com/package/dfasdfasdfs

HTTP/1.1 404 Not Found…

Copy

A 404 error page, therefore, is nothing more than a common web page (composed of HTML, images, scripts, etc.) accompanied, however, by a particular HTTP status code (the 404 code, in fact). This clarification is important, as, in the absence of this status code, browsers (as well as search engine spiders) would not be able to identify this page as an error page! Google, in its guidelines for Webmasters, suggests making sure your web server always returns an HTTP 404 status code when a missing page is requested, to avoid 404 pages being indexed as “normal” pages.

 

How to detect any 404 errors on our website

how to fix error 404 in wordpress website in 2020

If we run into any 404 errors and we think this is a problem, we can contact the webmaster of the affected site and ask them to verify what happened. Otherwise, if we are the owner of the website we can act directly to correct the error. So let’s see how to spot and fix 404 errors on our website.

There are various tools to identify the paths that generate a 404 error. For example, there are numerous online services to find broken links: using these tools it is not necessary to download and install anything on our computer, it will be sufficient to type the URL of our site into an online interface to obtain the ‘list of any broken links found.

In addition to these I point out two other tools, in my opinion, very useful in identifying any broken links on your website:

  1. Screaming Frog SEO Spider is a downloadable website crawler and auditor for Windows, Mac, and Linux that can be used to locate URLs that generate 404 errors. You can scan up to 500 URLs for free, but there is also a paid version. A guide is available on the official website explaining how to use Screaming Frog SEO Spider to spot 404 error pages.
  2. Google Search Console allows, among other things, to identify 404 errors generated by a website. Unlike the tools just seen, you need to link a website to your profile. It is possible to connect multiple websites to a single Google Search Console profile, but you must necessarily verify that you have the authorization to manage a website. To do this, just follow the simple procedure suggested by Google after logging in to the Search Console dashboard. Once you have confirmed that you own a site or have access to servers for management, simply add the sitemap of the site in Google Search Console. After Google’s crawlers complete the first scan, you can view the presence of any 404 errors using the section Scan Error item scan on the left side of the Google Search Console dashboard. To better use Google Search Console(previously called Google Webmaster Tools) you can consult our guide that explains how to best configure and use Google Search Console.

The ones I have reported so far are generic tools that can be used for any type of website. However, there are also specific tools for particular CMSs. For WordPress, the most used CMS on the Net, there are several free plugins for identifying 404 errors. The Broken Link Checker plugin, for example, once installed, searches for links on the site for those that cause an HTTP 404 error and reports directly within the dashboard for immediate identification by the webmaster.

 

What to do to correct 404 errors on our site

Error 404 Page Not Found

Once we have identified the URLs of the missing resources within our website, we can proceed to correct the 404 errors. The type of action to be taken in these cases is not unique but varies according to the cause that generated the 404 error.

For example, if a content, which has already been indexed, is moved or renamed, we can think of implementing a permanent redirect of type 301 appropriately. If instead the resource has been permanently deleted we will proceed to configure our site in a way such as to return the 410 error instead of the 404 error. Find more details in our guides that explain how to use and implement the 301 Redirect on a server and how to properly handle 404 errors at the SEO level.

In addition to moving and deleting a file, other possible causes of the 404 error can be attributable to server-side configuration problems:

  • When the URLs are dynamically generated 404 errors may occur following some error in the configuration of the permalinks in the CMS or of the URL rewriting rules at the web-server level. It may happen, for example, to make some mistakes in setting the base directory or the path of certain resources. In general, it can be useful to check the configuration files (for example .htaccess files on Apache or nginx.conf on NGINX). It is also important to check that the folder and file permissions are set correctly.
  • Another possible cause of 404 errors could be due to the change of protocol: in the transition from HTTP to HTTPS 404 errors may be generated due to an incorrect configuration of the SSL / TLS certificate and/or to the lack of bad configuration of redirects of HTTP resources to HTTPS ones. In this case, it is advisable to check that you have correctly set the redirects from HTTP to HTTPS.
  • Another reason why 404 errors may occur is related to exceeding the maximum memory available on the system. In this case, the easiest solution will be to interface with the hosting provider to request an upgrade of the features of the hosting plan in use.

In all the above cases it is advisable to correctly configure the error management system on the servers and refer to the log files in which we can find more information that can help us to resolve the errors generated.

 

How to “fix” 404 error when visiting someone else’s site

If you do not have direct access to the server that hosts a website, it may be more complicated to “solve” the 404 error, but, before contacting the site developers, we can try to find a solution to the 404 error, which is shown, in one of the following ways.

  1. Verify that the address entered is correct. The first trivial check that can be carried out is to make sure that the address typed, copied, or reached via a link is free of errors. In this case, it is good to check not only the protocol, the domain, and the path but also any parameters and the respective values ​​of the query string.
  2. Verify that the content has not been moved to a new address. The page you are looking for may have been moved to a new address and the server may not be properly configured to redirect requests from the old to the new address. In these cases, we can use a search engine or use the search function of the site itself, if present.
  3. Clear your browser’s cookies and cache. If the site you want to visit is not reachable from a certain device but works normally on others, you can try to clear the browser cache and delete the saved cookies, at least those relating to the site you are trying to visit. The procedure to follow varies depending on the browser but is usually carried out within the settings. Alternatively, you can try to access the developer tools and remove the cookies from the site that returns the 404 error.
  4. Change DNS servers or use a VPN. If an entire site returns the 404 error and not a limited number of pages, it could be that the DNS servers, configured on a device, are unable to complete, for various reasons, the domain name resolution process in IP address. You can then change the DNS servers within the network settings of your device. Alternatively, you can try to use a VPN that in many cases allows you to use the DNS servers of the company that made the software.
  5. View a cached copy of a page from a search engine. If none of the solutions seen above work, we can try to retrieve a copy of the page we are interested in through one of the methods explained in the next paragraph.

 

Error 404: How to view the contents of a missing page

Error 404 Page Not Found

If you do not have access to the server, you can not always find a remedy to error 404. However, we can try to view the contents of a missing page using tools such as Cache Google, the cache Bing, or similar services such as Internet Archive Wayback Machine and Cached Views.

 

Search engines like Google and Bing keep a copy of web pages for use in case a page is temporarily unavailable. This means that the cached copy may be out of date and may not match the latest version available. So let’s start by looking at how to use Google’s cache to view a past copy of a certain web page in case you can’t solve the 404 error otherwise.

To use the Google or Bing cache just perform a normal search by entering the name of the site or the specific address we are interested in in the search field. The result list will then be shown. At this point, just click on the small down arrow located next to the address in each of the results shown.

Read More: How to remove footer credit

Another extremely useful tool, which allows you to view previous versions of a particular website, is the Internet Archive Wayback Machine. It is an archive of snapshots of a website captured over the years. For each website, there is a timeline and a calendar in which it is possible to select one of the versions present in the database.

Once a specific date has been selected, we can see how a specific page of the site we are interested in looked like on that day.

 

How to create custom, usable and original 404 pages

While it is true that not all evils come to harm, it is possible to make a 404 page useful and turn it into an opportunity. It is good to pay particular attention to the creation of a customized 404 error page, always considering usability, explaining clearly and concisely what type of error occurred, and providing valid alternatives to continue visiting the site.

 

For example, the Medium site (an online publication platform created by the Twitter co-founder, Evan Williams) gives the possibility to search for new articles, inserts its logo at the top, and an explicit link that allows you to return to the home page. He then suggests three articles in which the keyword ” lost ” appears in the title.

 

Come to think of it, a user who hopes to view content and suddenly finds himself on a page showing an error message could be led to leave the site he is visiting … that’s why, if you care about your success. the site, you should pay special attention to creating a custom 404 error page.

We can take as an example the official Xbox site where the 404 error page (there are several versions) always shows the image of a video game accompanied by ironic writing (inspired by the video game represented) that signals the error to the user.

 

As we can see from these two examples, when creating a custom 404 page it is good to make sure that it has the same appearance and the same features as the rest of the site(for example the logo, the navigation bar, any internal search functions, etc.) and, in addition to providing information to the user about the error found, it must offer the latter the possibility to continue browsing without having to leave the site.

 

A pinch of irony is another common element of many 404 error pages: many famous brands have chosen to use this technique to exploit the error pages as an “extra tool” with which to strengthen their image or that of their products, in a nice, ironic and funny way, playing with images and words to minimize the user’s sense of frustration when faced with an error page.

 

As you may have understood, the common purpose is always the same: to prevent the user – in front of an error page – from leaving the website. How to keep him? With irony, proposing alternative navigation paths, games, or fun features … that incentivize him to stay or, in any case, do not make him feel “frustrated” with the mistake.

Conclusions

In this article, we have explained what the 404 Page Not Found error is and in which cases it occurs. We have therefore seen some examples to understand how this type of error is generated. We then listed some of the possible causes of the 404 error and showed how the 404 error can be solved from both a developer and a user perspective. In the latter case, having no direct access to the server, it is not always possible to correct the 404 error and it may be useful to try to view the contents of a missing page through some online services such as the Google Cache in which snapshots are saved of web pages each time they are visited by the crawler. Finally, we saw some examples of custom 404 pages that combine originality and usability to improve the user experience and prevent this from happening.

Did you find it interesting?

Sign up for our newsletter and get the latest updates from our network.

 

Leave a Reply

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