404 errors and how to fix them


  • Applies to: Grid
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: Account Center access
  • Applies to: DV
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: Account Center access
  • Applies to: Shared Hosting
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: Account Center access
  • Applies to: Managed WordPress
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: Account Center access

Overview

The following guide will provide you with information on the definition, causes, and solution for a 404 error message. 404 errors are a fairly common and almost website will experience them at some point. However, there are steps that can be done to mitigate some of the negative side effects that are often associated with this error.

STATEMENT OF SUPPORT:
Please keep in mind that troubleshooting the configuration/functionality of third-party applications is not covered by our statement of support. These resources were provided as a courtesy to assist you to the extent of our abilities. For more information on our statement of support, feel free to click here.

What is a 404 error?

A 404 message can also be referred to as a HTTP 404, Page Not Found, or Server Not Found message. This occurs because the client or server is unable to locate the content that a user is looking for. In everyday terms, it usually means someone has clicked on or typed in a URL and their web browser or the server wasn't abel to find it.

What causes a 404 error?

There can be a variety of causes for a 404 to occur. However, some of the most common are:

  • The user has a typo in their URL (accidentally writing example.con instead of example.com).
  • The URL location has been updated or moved (such as changing permalinks).
  • The URL was deleted or no longer exists.
  • The server is having a technical or configuration issue that is not allowing it to handle the request

Why should I fix a 404 error?

There are a good number of reasons you would want to resolve your 404 errors. However some of these include:

  • It can damage your SEO search results, as companies like Google take note of your 404's and may remove your website from their search results.
  • It can cause confusion or frustration for your visitors.
  • It can take up unnecessary resources on your server (CPU, RAM, etc).

Identifying 404 errors

The first step to resolving your 404 errors, is figuring out how to locate them. The following are a few different tools and websites that can be used to try and locate where your 404 errors are coming from:

  • GPU Tool: For Grid users, the GPU tool is available through your Media Temple account. You can look for 404 errors and find the file path(s) in question.
  • Dead Link Checker: This is one of the quickest methods for finding 404 pages. Simply enter your website URL and the site can check individual pages or your whole website.
  • W3C Link Checker: This site works similarly to Dead Link Checker, however it is generally more detailed in its testing. Therefore, it may take a bit longer to receive results.
  • Google Search Console: If you create a Google account and register your website, you can utilize this tool to have Google crawl your website to find errors (including 404s).

Update Permalinks

This first option is helpful if your WordPress site is experiencing 404 errors across all your pages.

  1. Log into your website's wp-admin wp-admin wp-admin wp-admin.
  2.  In the left-menu, click on Settings >> Permalinks.
    wp-1.png
  3. Just click on Save Changes.
    wp-2.png
  4. Although this may seem redundant, going through this process will reset your permalinks. If all your pages are experiencing 404 errors, this should generally fix that issue.
  5. In the rare case you are still experiencing issues, you can attempt to use an out-of-the-box .htaccess file.
    • Log into your site's root directory root directory root directory root directory, using a file editing method such as FTP FTP FTP FTP.
    • Disable your .htaccess file by renaming to something like .htaccess.old
    • Create a new .htaccess file and input the following code:
      # BEGIN WordPress
      RewriteEngine On
      RewriteBase /
      RewriteRule ^index\.php$ - [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.php [L]
      # END WordPress
      

Create a custom 404 error page

A custom error page will help address SEO demerits, confused visitors, and resource related issues that are associated with a 404 error. We recommend using a simple HTML page, since that will be the least resource intensive on your server. Having your error page be funny or light-hearted can help ease the minds of your visitors. Having a search bar or a button to return to your home page can also help visitors locate the content they are seaking on your webiste. Below is a quick example we made:

404-1.png

If you don't have a web developer to help you with creating a custom 404 page, you can try searching for free 404 templates, such as the ones on the sites below:

Using the .htaccess file

  1. Once you have a custom 404 error page created, connect to your server using FTP FTP FTP FTP.
  2. Navigate to your website's root directory root directory root directory root directory.
  3. Upload your 404 error page. In this example, we'll pretend our file is named not_found.html
  4. While still in your root directory, add the following code to your .htaccess file:
    # The following will redirect 404 errors to your custom 404 error page
    ErrorDocument 404 /not_found.html
    Be sure to replace not_found.html with your actual file path/name.

WordPress users

Most WordPress themes will include a generic 404.php page. However, there are plenty of free plugins you can use to create a custom 404 error page without extensive coding knowledge. These will typically autaomtically redirect 404 errors as well. Some of these plugins include:

Redirecting old / broken links

If you notice that customers are attempting to visit an old page or URL that no longer exists, you can attempt to redirect them to a new or similar page, rather than sending them to your 404 error page.

Using the .htaccess file

  1. Connect to your server using FTP FTP FTP FTP.
  2. Navigate to your website's root directory root directory root directory root directory.
  3. Edit your .htaccess file and input the following code:
    # Redirect old file path to new file path
    Redirect /olddirectory/oldfile.html http://example.com/newdirectory/newfile.html
    
    Be sure to replace the template file paths with your actual old and new file path.

WordPress users

There are a variety of free WordPress plugins available that can help you redirect old pages without coding knowledge. Some of these include: