Setup HTTP 410 Gone Error Status Code with .htaccess Redirects

How can you set up 410 Gone Error pages using .htaccess redirects? 410 error is an HTTP server response to signify that the particular webpage is gone forever, is permanently removed from the website, and is never going to come back. It is unlike the more common 404 errors which are displayed when a particular URL cannot be found on the server.

410 error code

 Setup 410 Gone Error Pages

The best way to set up the 410 error pages on Apache servers is to call the default 410 HTTP server response. Here is what we added to our .htaccess file in the root of the server.

Redirect gone /path/path/folder/
ErrorDocument 410 default

Note always keep a backup of .htaccess file before editing it as it a very powerful file and can take your site offline if incorrectly configured. It is important you add the path of the content folder and not the full http:// URL.

So now when you visit these pages, you get the default 410 error page from the server

410 gone error

404 vs 410 Errors

410 404 error

Google considers that 404 and 410 errors are same for all practical purpose and they deal with them in a similar manner.

Currently Google treats 410s (Gone) the same as 404s (Not found), so it’s immaterial to us whether you return one or the other.

But I figure that the main difference between the 404 and 410 status code is that while search engine bots keep trying to check if the 404 page is back or not, the 410 signifies the page is gone and possibly is checked less often or possibly never at all in the long run, as it is an HTTP server response which is purposefully created by webmasters for a specific serious purpose, unlike 404 errors which might happen due to any broken link or mistyped URL errors.

If your page is not disappearing from the Google index, do give 410 errors a try. Of course, if you intend to bring the URL back someday, it is always better to use a 404 error.

How We Use 410 Errors

Previously you must have read how WordPress theme backlinks led to a massive Penguin penalty on our site. We first removed 1.7 million backlinks, by forcing 404 errors, and then decided to 301 redirect backlinks to a new domain.

But the pages persisted in the Google index search results. The redirects did not cause the pages to disappear in the domain search results, though the pages were non-existent on the server.

Even efforts to remove URLs using the Google webmaster tools failed. A search for the domain reveals this –

persisting theme links

But then I setup the 410 gone errors for the pages, they have finally disappeared from the domain search results! I do not intend to bring these pages back, and nonexistent URLs backlinks do not count for penalty purposes.

Note removing the redirects and causing 404 errors will also remove pages from the index in a few days – as broken search results lead to poor search experience for users.

Share with friends

About the Author: P Chandra is editor of QOT, one of India's earliest tech bloggers since 2004. A tech enthusiast with expertise in coding, WordPress, web tools, SEO and DIY hacks.