How to Set Up 301 Redirects in WordPress

Arrow redirecting trafficWith 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.

I wrote back here about the SEO effects of 404 pages.

In that article I pointed out that Google’s recommendation was to leave pages that you remove from your site to return a 404 error, so that they eventually de-index them.

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 4 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 here are two from the site:

Simple 301 Redirects
Quick Page/Post Redirect Plugin

You can find still more if you search Google, but do beware: some of those results are very old and the plugin itself may not have been updated in a while. You should avoid those!

The benefit of getting a plugin from the WordPress site is that they display statistics on the number of downloads, when it was last updated, the WordPress version it’s compatible with and so on – important factors in finding a plugin that does its job without causing problems!

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.

Here’s the format:

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.

An example:

redirect 301 /the-entire-old-permalink-minus-the-domain-name/

Here are two explicit examples, first with your WordPress installation in a sub folder (/blog):

redirect 301 /blog/2011/5/25/old-permalink/

Secondly with WordPress in the root:

redirect 301 /2011/5/25/old-permalink

And that’s all there is to it.

As always, take a copy of your .htaccess file before you edit it, and keep it somewhere safe so you can upload it again should you make a mistake.

Some mistakes in the .htaccess file will result in the white screen of death, but all you need to do is FTP the clean .htaccess file to your server and you’ll be back in business.

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.


Martin Malden.

About the author: Martin has been working online since 2006 and focuses on two areas: 1) affiliate marketing and 2) designing and building websites based on WordPress. He has his own WordPress agency, and serves clients in Hong Kong, Australia and the UK.

What do you think?

Comments on this entry are closed.

  • Cary Lenore Sep 21, 2012 @ 4:02

    Thanks! Good to get confirmation that going the manual route is best, although a tad time consuming, when launching a new site.

    • Martin Malden Sep 21, 2012 @ 7:23

      Hi Carey,

      Sure – it may take a bit longer but it’s worth it in the long run 🙂