With the ever increasing emphasis on quality-of-content in the search engines’ algorithms, making sure you update or clear out articles which are either out of date or of little value is important.
So I spent a lot of time recently reviewing and either updating or trashing old articles on this site.
In a recent article posted by Google’s Matt Cutts, he said that Google’s recommendation was to leave pages that you remove from your site to return a 404 error, so that they eventually get de-indexed.
None-the-less, in order to maximise your site visitors’ experience, you still want to minimise the number pages that return 404 errors.
The answer is to place 301 (permanent) redirects on the URLs of pages that you’re removing where there’s another relevant page to send visitors to. Do this, and your visitors will be seamlessly routed through to the new article.
This also has the benefit of preserving the links that went to the old page and passing them through to the new page.
As I reviewed those articles from some years ago I found that, in a few cases, I’d written subsequent articles on the same or a similar subject – the perfect situation in which to remove the old article and set up a 301 redirect to the newer one.
How to set up a 301 (permanent) redirect in WordPress
With a plugin
The easiest way to set up redirects (of any kind) is through the use of one of the redirect plugins.
I used Redirection for a while. It did an excellent job for me and has the added benefit of tracking and reporting on 404 errors. This enables you to review those and set up redirects where appropriate.
There are other plugins that will help you set up and manage redirects. I’ve not used any of them, so I can’t offer any opinions, but a Google search will return plenty more.
But do beware: some of those results are very old and the plugin itself may not have been updated in a while. Be sure to follow these plugin evaluation steps before installing one.
Set up 301 redirects manually
All that said, my philosophy is to use as few plugins as possible on my sites, so I prefer to set up redirects manually.
This is easy enough to do, and will have some performance benefits. So if your page-load time is a consideration it’s worth getting to grips with manual redirects.
My preferred method is to set them up in the
.htaccess file. This is the simplest and most stable way to do it, plus it’s the one that affects page-load times the least.
How to set up redirects using the .HTACCESS file
You will need to access your
.htaccess file either via FTP or your hosting provider’s file manager.
Always be sure to take a copy of the file as a backup before making any changes – that way if you run into problems you can restore the backup to fix them.
So, once you’ve accessed your
.htaccess file there are two things to keep in mind:
- When you’re specifying the requested page (the one you’ve removed) you do not specify the domain name. Apart from that, specify the full permalink.
- When you’re specifying the destination page (the one you’re redirecting visitors to) you need to specify the entire permalink, including the domain name.
redirect 301 /the-entire-old-permalink-minus-the-domain-name/ https://www.the-domain-name.com/the-whole-of-the-new-permalink/
Firstly with your WordPress installation in a sub folder (
redirect 301 /blog/2011/5/25/old-permalink/ https://www.your-domain.com/blog/2012/6/26/new-permalink/
Secondly with WordPress in the root:
redirect 301 /2011/5/25/old-permalink/ https://www.your-domain.com/2012/6/26/new-permalink/
And that’s all there is to it.
Remember: always take a backup first.
One simple mistake in the
.htaccess file will result in the white screen of death, but all you need to do is restore the clean
.htaccess file to your server and you’ll be back in business.
Even better, just make one change at a time. That way, if it causes a problem you can just access the file and delete the change you just made. That will restore everything.
Cleaning out old articles that are no longer accurate or offer little value is increasingly important, and redirecting those links, where you can, to newer articles will preserve your links and improve your site-visitors’ experience.