410: When And How To Tell Search Engines Your Content Is Gone

When a search bot crawls your site, your web server responds with a header request code. We’ve shared quite a bit about the negative impact of search engines finding 404 errors (page not found) and how to utilize redirections effectively to redirect the user (and the search engine) with a 301 status code to a relevant page. Redirections are a critical search engine optimization (SEO) strategy because you may have links that pass authority to a page and help it rank better.
Redirects are used to point users to a new URL when a page or resource has moved and can help to salvage the authority passed in a backlink. Sometimes, however, you have a page no longer available, and the search engine should remove it from the search results. We do maintenance on older articles on Martech Zone often for platforms that are shut down and unavailable.
In these cases, you should present a 410 header code to the search engines (and a 410 template to your visitors). 410 indicates that the page or resource is no longer available and should not be accessed, indexed, as well as removed from SERPs.
Table of Contents
What Is A 410 Response Code?
A 410 error tells search engines that a page or resource has been permanently removed and should not be indexed or served in search results. Adam Small informed me about this solution. He has a real estate marketing platform with mobile tours that expired after the sale of a home. Google Search Console reported that he had a ton of 404 errors, which was likely impacting his visibility in search results. He added the 410s for the expired tours, and his site bounced back nicely.
Here are some additional examples where a 410 response code makes sense:
- Expired event – you promoted an event on your site and the date has passed.
- Discontinued product – you have a category or product line that is no longer available, you don’t have alternatives to redirect to, and you won’t be bringing them back.
- Person left – you removed a page for an author or employee that is no longer with your company.
Each of these examples has no relevant page to redirect the visitor to. In this case, you should use a 410 error instead. Using a 410 error, you can signal to search engines to remove the page from their index, which can help improve the overall quality and relevance of search results.
What Are Header Response Codes?
A response header is a part of the HTTP response that a web server sends to a client (such as a web browser) in response to a request for a web resource, such as a webpage or image file. The response header provides additional information about the response beyond the body of the response, which contains the actual content of the resource.
The response header is an important part of the HTTP protocol, as it allows web servers and clients to communicate important information about the response, such as whether it was successful or not, and how to interpret the content of the response.
Learn More About HTTP Response Codes And See a Full List of Codes
How To Add A 410 Redirect In Apache Using .htaccess
If you’re utilizing Apache, you can recreate this redirect in your .htaccess
file using:
RewriteEngine on
RewriteRule ^/page-gone$ - [G,L]
The RewriteRule
directive specifies the pattern to match and the action to take if the pattern matches. In this case, the pattern is the same as the one we used for the 301 redirect, but the action differs. The - [G,L]
part of the rule tells the web server to return a 410 Gone status code and stop processing the request.
If your site is using AMP, you should add a Regex to accommodate your AMP pages as well:
RewriteEngine on
RewriteRule ^/page-gone(?:\?amp=1)?$ - [G,L]
Or, if you’d like to accommodate any querystring, you can use this Regex:
RewriteEngine on
RewriteRule ^/page-gone(?:\?.*)?$ - [G,L]
How To Add And Manage 410 Response Codes In WordPress
We’ve written about how outstanding the Rank Math plugin for WordPress SEO is in the past. And of course, it’s no surprise that Rank Math can also handle your 410 responses. They provide a robust solution where you can even schedule when your 410 should be activated and deactivated.
In Rank Math, you’ll want to enable redirections on the plugin to provide the menu option to manage your redirections. If it’s your first time using it, you can even import your redirections from a CSV file or from other popular redirection plugins.
- Select the 410 Content Deleted button on the Maintenance Code section.
- Type in the Source URL of your expired content.
- Optionally add a category if you wish to organize your entries, the scheduled activation date, and the scheduled deactivation date.
There’s no need to add the ^/ in the Rank Math Source URL field. And, if you’d like to use Regex to accommodate a querystring or trailing slash, you can enter:
page-gone(?:\?.*)?$
Download Rank Math For WordPress
How To Display A Custom 410 Page To Visitors
You may wish to add a 410 page template to WordPress to handle these requests.
Step 1: Add a 410 Page Template
Add a page called 410.php
to your child theme. For my site, I just copied the 404.php theme page, modified the content, and added the following directly under my get_header();
command:
// Set the header code for a 410 page
header('HTTP/1.1 410 Gone');
Within your child theme, build a 410 template that lets your visitors know the page has been removed from the site.
Step 2: Add a Function To Call That Page When You Want to Display a 410
Within functions.php, you must add a function that sees that header code and properly displays the 410 template.
// Custom 410 Template
function custom_410_template_redirect() {
if (get_query_var('error_status') == 410) {
status_header(410);
include(TEMPLATEPATH . '/410.php'); // Replace '410.php' with the actual name of your 410 template file
exit;
}
}
add_action('template_redirect', 'custom_410_template_redirect');
Step 3: Call the 410 Where Appropriate
In my site’s case, I want to display a 410 result when an author is called that no longer has any articles on my site. I often remove outdated articles on platforms or topics that are no longer relevant – so if that author has no posts published, I want to let the search engines know that they can remove that page from the index. I do that with the query in the page:
<?php
/** Author.php template **/
global $wp_query;
if ($wp_query->found_posts == 0 || !get_userdata(get_query_var('author'))) {
status_header(410); // Update the status code to 410
nocache_headers();
include(get_query_template('410')); // Direct to 410 page
exit;
}
Tip: This is one of those tools that you may wish to use sparingly and only if you must remove these pages rather than redirect the search engine or visitor. If you can provide a relevant path to new content that makes sense, I would prioritize that option over a 410.