Sometimes, content on our sites becomes irrelevant or out of date, and we need to decide whether to update it or delete it which is pretty normal and it’s part of your regular content maintenance activities. Now updating is really a good way to freshen your content but at times we really want to delete posts that have already been published (and possibly indexed). In this article, we’ll be talking about how you can properly and safely redirect or delete content from your site or WordPress Blogs.
Why do we Redirect or Delete Content from our Sites?
There can be many reasons for it. It’s likely that you have old posts or pages on your site that you don’t need anymore. For instance, you have a blog post about a product you stopped selling a while ago and have no intention of ever selling again or an announcement of an event or giveaway that took place a long time ago or old pages with little or no content or content adds no value anymore.
Cleaning up old content should be part of your content maintenance routine. If you don’t go through your old posts regularly, you’re bound to run into issues sooner or later. You might show incorrect information to visitors or hurt your own rankings by having too many pages about the same topic, increasing chances of keyword cannibalization, which is a lot of work to fix later on. Therefore, go through your old posts, and decide what to do: update, merge or delete.
In any of the case, you need to either tell Google to forget about these old posts or pages or redirect to a new and updated content.
Redirecting URLs should be part of your regular website maintenance. There are many reasons for using a redirect, but these are the most common:
- Deleting a page or post
- Moving your site to a new domain
- Dropping the use of www in your domain
- Enabling permalinks in WordPress
- Merging websites
- Changing your CMS
- Changing your URL structure
How to Safely Delete Content Posts or Pages?
When Google can’t find a post, the server will usually return a “404 Not Found” status to the search engine’s bot. You’ll also find a 404 crawl error in your Google Search Console for that page. So when you delete a page, it doesn’t just disappear from the search engine index. That means that people could still land on it. When they do, they’ll find a 404 error. That’s a poor user experience, which can be harmful to your SEO. It also means that any value that page had (from links and mentions) is lost forever. Eventually, Google will work it out and the URL will gradually vanish from the search result pages. But this takes time.
So it’s really important to avoid those dead-ends. You can do this by redirecting your users to another page. There can be many types of redirections. The important one are:
- 301 Permanent redirect: 301 is the right kind of redirect for permanently deleted or moved pages, as well as pages with a refreshed permalink structure. When search engines see the redirect code, they understand that the page is no longer available. So, they stop indexing it – and that’s exactly what you want!,
- 302 Found and 307 Temporary redirect: Both 302 and 307 are temporary redirects. The difference is that the 302 code contains less information about the redirect. 307 is less vague and it tells search engines that the content has a temporary location, but it will be back soon.
- 410 Content deleted: You can use this redirect when you delete a post or a page for good, and you know for sure it will not be coming back. The 410 code tells search engines that they should delete the page from their index. The 410 is more powerful in the sense that it tells Google that the page is gone forever, never to return. You deleted it on purpose, period. Google will act on that faster than with a 404.
- 451 Content unavailable for legal reasons
“301 Permanent Redirect” the Old Post to a Related One
With a 301 Redirect you tell search engines like Google and visitors there is a better or newer version of this content elsewhere on your site. The 301 redirect automatically sends people and Google to this page. This is done when a URL still holds value because, say, you have a number of quality links pointing to that page, you want to leverage that value by redirecting the URL to a related one.
For example you have an old post on a specific SEO Trick that is no longer being used or implemented by search engines now a days. You need to delete it, so the logical next step would be to redirect that post to a newer post about this SEO trick. If you don’t have that post, choose a post about the closest SEO trick possible. If that post isn’t available, you could redirect it to the category page for these posts (e.g. “SEO”) and if that is also not an option, redirect to the homepage.
A 302 is a fairly ambiguous redirect and is often used as a temporary redirect. The code means that the requested content has been found, but it lives in a different location. It doesn’t say why. If you want to send visitors to an alternative page when visiting this particular page, and you want to reuse the URL in the future, use a 302.
Since this is a temporary redirect, it doesn’t pass link value. Hence, it’s possible to reclaim the URL with its value intact. Just don’t use it when moving a site to a new domain or when you’re doing other large-scale re-organization on your site.
307 Temporary redirect
302s are often used to create temporary redirects, but, with the advent of HTTP 1.1, 307 has replaced it as a valid temporary redirect. While a 302 is a little vague, a 307 states precisely that the requested URL has been moved to a temporary location and will be back in a while. Since this request can change in the future, the request should continue to be made using the original URL. Use this redirect if you’re sure the move is temporary and you’ll still need the original URL later on.
404 and 410 HTTP headers
404 error pages are one of the biggest problems on websites, and if you look at your readouts in Google Search Console, you are bound to find a few. These must be fixed as fast as possible because no-one likes these errors: Google sees them as a sign of bad maintenance, and visitors are confused by them. 404 errors often occur when the requested page or post has been deleted from the site and the URL has not been redirected.
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.
Use a 301 to redirect pages showing 404 errors to a relevant page, or the homepage. Sometimes, however, you might prefer another method: telling search engines – and users – this page has been deleted with a 410 redirect. They will then know that the page won’t return and can, therefore, delete the page from the index.
451 Content unavailable for legal reasons
Should you ever be unlucky enough to be ordered by a judge to delete a page or if you get a notice and takedown request, give the deleted page a 451 header. This tells search engines that there was a post here and that you wanted to fulfill this request, but you can’t for legal reasons.
How to Redirect a Post?
The name ‘redirect’ pretty much says it all: It sends visitors travelling to a specific page to an alternative one. But what does this 301 mean and how does it differ from a 302 redirect? Both send your users to a different page. The only subtle (yet very important) difference is that a 301 will permanently send visitors and search engines to the new destination. 302 redirects indicate that you only temporarily want visitors to be sent to a different page.
There are three main ways to safely redirect or delete content from our sites:
By Editing .htaccess file on the server
It was one of the most basic methods of adding a 301 redirect, is by editing your .htaccess file on the server. This method is only available on Apache servers. Nginx has their own way of defining redirects in the server configuration and requires extensive knowledge of system administration.
These configurations can get quite unmaintainable over time, especially if you’re an avid blogger or you’re trying to improve the SEO of your posts. Besides, you would have to log in on your server over FTP, edit the files and re-upload them every time you add a new redirect. That’s why, generally speaking, using this method is not considered the way to go.
By Creating a Redirect with PHP
This method is a bit easier than editing files on the server, but can also become cumbersome once the amount of redirects increases.
As a WordPress developer, you have two options: Either you make a redirect by altering the headers of a file in the code -or- you make use of WordPress’ built-in
An example of plain PHP could be as follows:
<?php // MyExampleFile.php header("HTTP/1.1 301 Moved Permanently"); header("Location: http://www.my-blog.com/a-new-destination"); ?>
And this is how you’d do the same, but now by using WordPress’ built-in function:
wp_redirect( "http://www.my-blog.com/a-new-destination", 301 );
If you forget to add the
301, both WordPress and PHP will both assume that it’s a
302 redirect, which isn’t always the case.
By Using WordPress Plugins
Important to Note
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!
Also, be careful when choosing your redirect! And don’t 302 your entire site when you’re moving to a new domain because you’ll cause serious problems down the line. Think about what you want to accomplish, and then pick the most appropriate redirect method.