How To Redirect a WordPress Page or Post

The Why & How of Redirecting A WordPress Page or Post

In this post I am going to explain why you would need to Redirect pages/posts in WordPress, and a few easy methods to do it.

As your WordPress website gets bigger and bigger, there are certain things that start to show signs of wear and tear.

Things start to slow down as you add more and more content and images, and there are various solutions for that.

But another less obvious area you need to keep an eye on, is your links!

What happens if one of your links are broken? 

A page has moved?

Or someone has written a link wrong – but it is an awesome link/website? 

You would want to fix that ASAP!

And you can. Here’s how…

The Hows and Whys of WordPress page redirection

FREE BONUS

Steal my personal WordPress SEO Cheatsheet

Learn how to boost your traffic in under 10min per post or page

Why You Might Need To Redirect Pages in WordPress

To make things simple I am going to list the kinds of reasons you might need to Redirect A Page or post.

  1. You no longer liked the name of that page or post and changed it, along with the URL/permalink
  2. Someone made a mistake when typing in a URL and you want to correct the spelling
  3. You want to add a keyword in your URL for SEO purposes
  4. You are moving your content/blog posts to a new directory
  5. You are changing from dates in your URLs to plain links (eg. /2015/08/07/post-name   to /post-name)
  6. Someone has linked to your best content and given the wrong URL (you are not able to contact them)

As you can see, the list of reasons you might need to redirect a page is almost endless. In fact, I was browsing a new addition to the Yoast Plugin recently, and they allow you to connect to Google Webmaster Tools. By doing this you can see all the 404/Page not founds Google knows about. Then I decided in some cases to put Redirects in place because I did not know for 100% where they were coming from. Redirects are very helpful and are part of your arsenal as a websites owner or webmaster!

What Is A Redirect (And An Example)

Just a quick example before I get into what kinds of plugins you can use. Redirects are actually quite simple. 1. They are basically telling the web server (the computer that is running your website)

  • the new address/URL (where to send someone)
  • instead of the old URL (where something was before – or where people thought it was in the case of a 404 error)

So when you are creating a Redirect in WordPress you need to know both of those things (old/wrong address, new address). 2. Then there is the type of redirect. They are all in the 300 range and actually there are not many you would ever use, they are:

  • 301  (permanent redirect)
  • 302 and 307 (temporary redirect)

If you want a lot of detail on what redirect to use, check out this post from Moz, but basically you should almost always use 301 Redirects – unless you are 100% sure the page is already indexed by Google and it is only a temporary move. So more most cases you would encounter (wrong address, moved page etc) 301 Redirect is the one to use, and most of the plugins below will use 301 by default.

A Quick Example:

I have permanently moved my WordPress Services page (http://madlemmings.com/wordpress-services/) to my new services page ( http://madlemmings.com/services/) So I want all people who go to the old page to be redirected permanently to the new one above instead. This is a permanent move and I want all links to go there and Google to be aware of that. Old:  http://madlemmings.com/wordpress-services/ New: http://madlemmings.com/services/ Redirect Type: 301  (Permanent)

 

How To Add Redirects In WordPress

There are two main ways to add redirects in WordPress.

  1. The easy way – using a plugin
  2. The more technical way – using htaccess files

If you do not want to get your hands dirty (ie. you are non-techy) then read the first section on Plugins for Redirects. If you want to learn a little more to control your website from the file system (and actually it is not hard) then read the second section on the htaccess files.

Using Plugins To Add Redirects in WordPress

Note: This section is for non-technical people – those not wanting to touch any files on WordPress. There are a number of plugins that you can use to manage your redirects in WordPress. ** All plugins mentioned here are currently maintained, up to date and well reviewed.

Safe Redirect Manager

Safe Redirect Manager

(4.9/5 star reviews on WordPress) This is a very simple redirect plugin that allows you to:

  • Enter the from and to URLs (so the page the visitor aims for, and the one you want them to actually go to)
  • Choose the Redirect status code (301 redirect is the standard if a page/post has moved or is wrong)

You also get a page with an overview of the redirects you have in place.

Quick Redirect Plugin

Quick Page/Post Redirect

(4.5/5 star reviews on WordPress) This is another quite simple redirect plugin (like Safe Redirect above) but has a few more features that might help you out. You can do:

  • simple from/to redirects
  • set the redirect type (default is 301 – permanent, but you can do temporary etc)
  • it also allows you to redirect to posts/pages without knowing the URL
  • it is also useful for redirecting 404/page not founds as it does not requiring an existing page/post (although most are like that)

If you want more complex functionality than either of these plugins try Redirection below.

Redirection Plugin

Redirection

(4.2/5 star reviews on WordPress) This one is a little more full-featured and comprehensive, and might make your life as a website owner a little easier. It can help you do all of the following:

  • Redirect pages and posts (for any reason)
  • Automatically redirect pages/posts that you move
  • Inform you of any 404/pages not found that it has found
  • Log all redirections so you can see if there are issues (who, what, when etc)
  • Redirect things based on login status, referrer etc (handy if you want to control people inside your site)

There are of course more features, but these are the most interesting ones I found.

Redirects With The .htaccess Files

Although this is the more technical way to add a redirect, it is actually not that difficult. So if you are at all interested in learning more about how your WordPress installation works this is worth doing.

A .htaccess file has the ability to control a lot of things on your web server, such as who can see files or directories, whether compression is enabled and much much more. It is a very flexible and powerful file.

And in fact the .htaccess file we need to change is located directly in the main WordPress folder of your site.

Yes, there can be others in deeper folders, so be sure to use the right one.

Using CPanel To Change The .htaccess File

Most of you will be running WordPress on a server with cpanel installed. So I wanted to show you how to find the .htaccess file.

  1. Obviously you login to your cpanel first
  2. Open the File Manager
  3. While opening the File Manager be sure that it is showing hidden files (see image below)
  4. Open the file to edit as normal (I use right click – edit)

Note: .htaccess is a hidden file, so if you DO NOT check that “show hidden files” you won’t see the file at all!!

Inside The .htaccess File

Once you have the .htaccess file open you will most likely see the following:

Note: Be sure to add the redirect code below this code shown above. This way you will not break anything.

Adding The Redirect In The .htaccess File

Now you have the .htaccess file open (perhaps through cpanel or directly on the file system) and now all you need to do is add the following line to the file.

Redirect 301 old-url new-url

A more concrete example is in order, so let’s take the same example from earlier in this post of moving my old services page (wordpress-services) to my new one (services)

Redirect 301 http://madlemmings.com/wordpress-services/ http://madlemmings.com/services/

You can also shorten these URLs but you need to be sure that you are not accidentally redirecting similar pages, so if you don’t have a full grasp of the above stick with the full path.

There is obviously a lot more to this and you can read more about how to use Redirect here.

You can also use Apache’s mod rewrite, which is even more powerful, but it appears more complex so I left it out for the beginner’s sake.

You can read all about that in a good article on Search Engine Land on using that and more.

Using WordPress Page Redirects

Sooner or later you are going to need to use redirects, whether it is because you are moving a page/post, have a 404 error (page not found) or want to do affiliate marketing (although there are better plugins for that).

So why not try one of the methods above to help keep your website under control and make sure your visitors are getting to the right page.

FREE BONUS

Steal my personal WordPress SEO Cheatsheet

Learn how to boost your traffic in under 10min per post or page

About the Author Ashley Faulkes

Ashley is obsessed with SEO and WordPress. He is also the founder of Mad Lemmings. When he is not busy helping clients get higher on Google he can be found doing crazy sports in the Swiss Alps (or eating too much chocolate - a habit he is trying to break).

follow me on:

Comments are closed