WordPress Managed Hosting - 40% Off For 4 Months - Coupon Code: BFCM2021 Avail Now

The Ultimate Guide for 404 pages in WordPress

Moeez — May 17, 2017 4 Minutes Read

If you have been using the internet for some time now, you must have come across the phrase “Page not found”. It is an error page technically known as “404”. The reason for this error is that every time a user tries to reach a page for which a website cannot load or that a website’s link is broken, a “404” is generated and displays a message that says  “Page not found” to the user.

Each website handles this error in a unique fashion, but the idea behind all of them is the same. Moreover, the font and page style may vary from site to site.

This article will help you in handling 404s on your WordPress website. The following points will be covered in this post:

  • What is a 404 and how does it happen
  • How WordPress deals with a 404
  • How you can design a good 404 page
  • How to keep a user from leaving your website in case of a 404

What is a 404 error?

The “404” or “page not found” error message is basically the response of HTTP (Hypertext Transfer Protocol) in a computer network. While communicating with a server over an HTTP protocol, a server always serves a website in order to show data on the browser.

So in case of an error, the server is there to serve the error so that the user knows there is some issue. The first “4” indicates a user error, such as spelling mistakes in the URL, while “04” explains how the actual error occurred.

Why WordPress Websites Need a 404?

WordPress is one of the most popular and easy-to-use tools for web development. People nowadays are using WordPress to create blogs, websites, and run their businesses. WordPress makes it very easy to put URL onto a site and change the permalink structure for SEO or any other purposes.

Suppose you have successfully created a WordPress website, and you are about to launch it over the internet. Having said that, you do not know that there is a page link in your site which was supposed to be “http://www.yourdomain.com/gallery”, but you somehow put it as “http://www.yourdomain.com/galery”, which is wrong. Due to this error, your page will not show up whenever a user clicks on that page.

So basically you have a broken link on your website for that specific page. This is where an error message should appear in order to make the user understand that there is something wrong.

How Does WordPress Handle 404s?

Whenever a user clicks on a page that does not exist or its link is broken, WordPress checks for two files in the system:

  1. php
  2. php

If the theme being used in the website contains a “404.php” file, WordPress will load that page and show the error to the user. But if that page is not found, then WordPress will look up the “index.php” file, and take the default action for a page not found or a broken link.

How To Design a 404 Page?

Most WordPress themes contain a 404.php file, which is usually found in wp-content/themes/active-theme. You can modify that page in order to make it attractive so that the user doesn’t bounce off to another website.

You need to consider the following scenarios before creating a 404 page:

  • Where the 404 is coming from?
  • How to fix the error (broken links, misspelled URLs, etc.), which is directing the user to a dead-end?
  • How to keep the visitor hooked on to your site instead of bouncing to another?

How to Repair the Broken Links?

There are two ways a user might end up with a 404 error when visiting your website:

  1. 404 due to following an internal link on your site
  2. 404 by following an external link from another website to your site

You need to check each of your website’s URLs to make sure that every page is working perfectly. If your website has more than 50 links, it will take you many hours to check each URL and pinpoint the one with the problem. However, there are different tools available in the market, which you can use in order to check whether there are any broken links on your website. By using such tools, you can easily find out the issues on your website and fix them.

Top Plugins To Check Broken Links

  1. Google search console (Free)

It is one of the fastest tools that is used for detecting broken links on your sites. Other than detecting broken links, it can help you to do a variety of things, including:

  • Submit and check for a sitemap.
  • Allow you to write a robot.txt file to let you know about pages that are blocked accidently.
  • List internal and external pages that are linked to your website.
  1. W3C Link checker

It is also an online tool which can help you in checking broken links on your website. All you need to do is enter the URL and the software will check for everything. W3C Link Checker also allows you to upload a file and check it.

Other features include character encoding, document type, and several others, which can help you to find exactly what you are looking for.

  1. Broken Link Checker

Broken Link Checker is an online tool that validates your website and detects broken links. It can check for both external and internal links of your website and can detect broken links so that you can fix them. Other features of this online tool include:

  • Checks your site against ideal links
  • Unlimited page scan
  • Reports errors and bad URLS
  • Checks both internal and external links
  • Runs on all platforms (OS)
  1. WP Broken Link Status Checker

This plugin will help you to check for different issues on your website. It:

  • Monitors links in your posts, pages and comments
  • Easily finds links that are not working
  • Notifies you about the broken links via email
  • Is easily configurable

Conclusion

The 404 and other errors impair the functionality of your website and have a negative impact on the image of your online business. It is crucial that you stay vigilant in order to ensure that there are no broken links or any other problem with your website.

Create Faster WordPress Websites!

Free eBook on WordPress Performance right in your inbox.


    Create Faster WordPress Websites!

    Free eBook on WordPress Performance right in your inbox.

      Moeez is ‘The’ blogger in charge of WPblog. He loves to interact and learn about WordPress with people in the WordPress community. Outside his work life, Moeez spends time hanging out with his friends, playing Xbox and watching football on the weekends. You can get in touch with him at moeez[at]wpblog.com.

      THERE'S MORE TO READ

      Newsletter

        WordPress Help Zone - Ultimate WordPress Pit-Stop

        Learning WordPress? Or are you expert enough to help others? Join our WP Facebook group!