Joost de Valk
Joost de Valk is the founder and Chief Product Officer of Yoast and the Lead Marketing & Communication for WordPress.org. He’s a digital marketer, developer and an Open Source fanatic.
Whenever you delete a page (or post) from your site, you also delete one or more URLs. That old URL, when visited, will usually return a ‘404 not found’ error, which is not the best thing for Google or your users. Is that what you really wanted to happen? You could redirect that deleted page to another page, or maybe – if you really want the content gone from your site – serving a 410 header would actually be a better idea. This post explains the choices you have and how to implement them.
Did you know Yoast SEO Premium has an awesome redirect manager that makes the redirection of deleted posts a breeze? Try it out!
Redirect or delete a page completely?
The first thing you have to work out is whether or not the content you deleted has an equivalent somewhere else on your site. Think of it this way: if I clicked on a link to the page you deleted, would there be another page on your site that gives me the information I was looking for? If that’s true for most of those following the link, you should redirect the deleted URL to the alternative page.
In general, I’d advise you to redirect a page even when only a handful of the visitors would benefit from it. The reasoning is simple: if the other option is for all your visitors to be sent to a “content not found” page, that’s not really a great alternative either…
Create a redirect
There are several types of redirects, but a 301 redirect is what’s called a permanent redirect, and this is what you should use when you redirect that deleted page URL to another URL. Using a 301 redirect means Google and other search engines will assign the link value of the old URL to the URL you redirected your visitors to.
Deleting content completely
If there really is no alternative page on your site with that information, you need to ask yourself whether it’s better to delete it or keep it and improve it instead. But if you’re absolutely sure you want to delete it, make sure you send the proper HTTP header: a ‘410 content deleted’ header.
404 and 410 HTTP headers
The difference between a 404 and a 410 header is simple: 404 means “content not found”, 410 means “content deleted” and is, therefore, more specific. If a URL returns a 410, Google knows for sure you removed the URL on purpose and it should, therefore, remove that URL from its index much sooner.
Our Yoast SEO Premium plugin for WordPress has a redirects module which lets you set 410 headers. The redirect manager is the perfect tool for working with redirects, automatically asking you what you want to do with a URL when you delete it or change the permalink. Of course, you can set any type of redirect.
The problem with serving 410 content deleted headers is that Google’s support for it is incomplete. Sure, it will delete pages that serve a 410 from its index faster, but Google Search Console will report 410s under “Not found” crawl errors, just like 404s. We’ve complained to Google about this several times but unfortunately, they have yet to fix it.
Collateral damage when deleting a page
When you delete one or more posts or pages from your site, there’s often collateral damage. Say you deleted all the posts on your site that have a specific tag. That tag now being empty, its archive’s URL will also give a 404. Even when you handle all the URLs of those posts you deleted properly (by redirecting or 410ing them) the tag archive will still give a 404, so you should make sure to deal with that URL too.
Even when you didn’t delete all the posts in a tag, the tag archive might now have 5 instead of 12 posts. If you display 10 posts per page in your archives, page 2 of that archive will now no longer exist, and thus give a 404 error. These aren’t the biggest problems in the world when you delete one or two posts, but if you’re dealing with a Google Panda problem and because of that deleting lots of poor content, creating a lot of 404s like this can take your site down even further, so proceed with care!
Read more: Which redirect should I use? »