Web Development

Http 410 status code

By Jazz, on April 5, 2021 - 2 min read

If you are here, you have just encountered a error code 410.

Http 410 response code definition

The Http Status 410 Gone (HTTP = HyperText Transfer Protocol) is one of the client status codes (the 4xx series) indicating that access to the requested page or resource is no longer available on the server, a priori permanently, and no redirection address for that page or resource is known.

error 410 gone problem
Image by Andrew Martin

This is different from the Http 404 Not found status, which means that no page or resource can be found at the requested address, but the server says it’s not final.

Difference between Http 404 and Http 410 status for SEO

When Google crawls your website to index your pages, it will treat each page or resource differently depending on the Http code returned by the server.

In the case of Http 404 Not found response, the server tells the robot that there is a temporary problem. It will there come back within 24 hours to recrawl that page and do an action. If the page is still in 404, it may decide to remove it from its index, with the aim of not directing a user to a page that doesn’t work.

In the case of a Error 410 Gone, the server tells the robot that the page is definitely gone. Knowing this information, the robot doesn’t have to wait to make the decision to delete the page from its index so that it is no longer presented to Google users.

The robot will come back later to check that this page has disappeared and that the server had not returned a wrong code.

It is always important to be concerned about all status codes returned by your server as they can have a negative impact on Google’s crawl of your site.

Find out what Google says about 410 status: https://www.searchenginejournal.com/google-404-status/254429/

How to handle 410 errors on your website

As 410 status code can penalize your website’s crawl, it is important to monitor them.

Customize a Http 410 status page

Finding a web page in error when visiting a website is frustrating for the visitor.

It is therefore important to customize error pages to explain to the visitor why there is this error and what to do.

How to do it in 3 steps on an Apache server

  1. Edit your site’s .htaccess file if you’re on an Apache server by adding the code pointing to the page to present to the user corresponding to http 410
ErrorDocument 410 <local-path>/error-410.html

2. Create the page error-410.html. Put yourself in the visitor’s shoes. He is disappointed that he cannot find what he is looking for. What should you tell him? A humorous page can lighten the mood. Explaining the problem and pointing them to an alternative solution will keep them browsing.

3. Test your new page to make sure everything works and the message is relevant.

And on NGINX?

The steps are the same but for the first one, NGINX doesn’t have an .htaccess file, so you have to modify the configuration file which is in the etc/nginx/sites-enabled directory.

You will use the default server block file if you have not created a specific file for the configuration, otherwise your specific file. Add

server {

...

        error_page 410 /custom_410.html;
        location = /custom_410.html {
                root /usr/share/nginx/html;
                internal;
        }

...

}

Read also: understanding the Youtube 503 status code.

Jazz