Using the Redirection Plugin

Sorry that I neglected this series! I’m coming back to it now. I was getting into Web 2.0 with a lot of my posts, and I forgot that one of the main niches of my blog is SEO. This post is mostly on using the redirection plugin (there’s a download link if you click Learn more…).

Redirection Plugin

The third article in the Full Guide to WordPress SEO is on the redirection plugin for WordPress. The redirection plugin allows you to handle different redirects. Please note that your must be using WordPress 2.7 for this plugin to work correctly.

The best part of the redirection plugin is that it doesn’t require a modified .htaccess to function. It implements all of it’s redirects through WordPress.

Installing the Plugin

Installing the plugin is the same as installing any other plugin. You can download the plugin here. Just unzip the plugin in your /wp-content/plugins/ folder.

Setting up WWWs

The first thing that you can do with the redirection plugin is set up your WWW settings. You should have already choosen a primary domain (when you installed WordPress). I choose http://gulati.info over http://www.gulati.info. Having both the main domain (gulati.info) and the subdomain (www.gulati.info) is a bad SEO practice. You can use the redirect plugin to redirect all of the hits on your subdomain to your main domain, or vice versa.

Go into the Redirection menu (it’s under Tools on the left). This will bring you to the main redirect page. You will see the navigation across the page somewhere (usually at the top, or under some text). It will look like this:  Redirects | Groups | Modules | Log | Options. To set up the WWW settings, you want the Modules Tab. After you click the module tab, you will see three gray boxes. They should be titled WordPress, Apache, and 404s Errors. We want the WordPress box. Click Edit in the WordPress box and a few dropdowns will appear. Here we can set up the WWW settings or other settings. Next to Canonical, select either Strip WWW or Force WWW, depending on what you picked for a domain. Please note: If you pick two different settings, example your WordPress domain is http://www.gulati.info, but you pick Strip-WWW, it will create a redirect loop. You will not be able to access your blog until you fix this (you can still access the admin panel.) While you are on this page, you should probably set up Strip Index. Normally, you can access the index of my blog at http://gulati.info or http://gulati.info/index.php. Both of these pages are identical, so for good SEO you would want to set http://gulati.info/index.php to redirect to http://gulati.info. Next to Strip Index select Strip index files (html, php, asp). Your current setup should look like this:

This is the suggested setup for the WordPress module.

This is the suggested setup for the WordPress module.

If you are using Force WWW, that will obviously be different.

Setting up Modified Posts

The next thing you need to do with the redirection plugin is set up (well actually, you don’t have to) the modified posts redirection. Modified posts redirection is automatically enabled when the plugin is installed. This is probably the most important redirection that this plugin provides. If I create a post with a URL of http://gulati.info​/2009​/01​/cakephp-speed-up-developmen​/, and then, after time, notice the spelling mistake and change the URL to http://gulati.info​/2009​/01​/cakephp-speed-up-developmen​t/, a problem is created. Instead of making the original URL a dead URL, the redirection plugin can make it redirect to the new post. The redirection functions fine without any settings change, but you can choose to monitor the redirects.

You can enable URL Monitoring to view statistics of redirects.

You can enable URL Monitoring to view statistics of redirects.

To do this, head over to the Options tab and then scroll down to URL Monitoring. Select Modified Posts for both selects, and then hit Submit.

You can now view statistics and a log of redirects. Head over to the Groups tab and look at the line titled Modified Posts. It’s probably empty at the moment, but it will show the number of modified posts later. It will also give you a total number of redirects and a list of the redirects done.

All finished!

Your redirect plugin is now ready to go! Hopefully this will improve your WordPress SEO a little (remember, it’s the little things that help!). I will go over another plugin soon! I’ve been writing about Web 2.0 a lot recently, but I want to get back to SEO.

If problems occur

Here’s a few things to check if you are experiencing problems with the plugin:

  1. Go to the plugin configuration home and select ‘Groups’ on the top bar. There’s other groups of redirections, some of which are automatically created. Check everything here to make sure that nothing is causing a problem.

Still having trouble? Please please please leave a comment. :) I’m happy to help!

80 Responses

  1. Hi guys,

    I just read an article recommending to change the permlink to /%postname%

    Here is the exact quote from the article

    ************
    If you were using any other permalink structure than the default you will need to install your choice of plugin to redirect any of your indexed pages to the new location. My preference is Redirection which is also developed by the good folk at UrbanGiraffe.com. If you decide to use redirection, install it, activate it, and under Manage > Redirection > Options, ensure that both URL Monitoring select boxes are set to “Modified posts”. You will now have perfectly optimized permalinks without having to do anything else, or worry about duplicate content issues or 404 errors that could lead to search engine penalties.
    ********

    So I downloaded the “Redirection” plugin and now I don’t know if I am coming or going, could you help me with the setup, the article made it look so simple but I found out that there is a million options to choose form.

    I had my permlink set up to (Day and Name)

    http://www.recipetrezor.com/2009/09/26/sample-post/

    and my intention is to change to (Custom) /%postname%/

    could you take me through a step by step how to set up this in Redirection.

    Thank you

  2. I’m hoping the re-direction plugin will solve my problems. As you have obviously looked into its working closely I’m prompted to ask two questions.

    1) if I install the plugin should I get rid of the current .htaccess file a previous admin installed but which is not doing the full job?

    2) will the plugin deal with the problem I have that the blog was once in a sub-directory /blog but is now in the root directory? (Google webmaster tools reports crawl errors from the old /blog configuration.

    Thanking you in anticipation.

  3. Hi Des,

    1. It depends. You should definitely clean out any old redirects or rewrites that were there. There are a few things in the .htaccess that are necessary for WordPress, though.

    It should look something like this:

    # BEGIN WordPress
    
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    
    
    # END WordPress

    2. Yep, that’s actually what it is for. You could do something like:

    Source URL: /old-directory/*
    Target URL: /

    (make sure that the regular expression box is checked)

  4. @Austin — the Kink of Regex here ;)

    I have another problem that you might help me to solve in just seconds. I use the Language Switcher plugin and recently I had to change my URL syntax from this:

    ^/lang/en/

    to this

    ^/?lang=en

    Just the end of the line has to be changed in the URL. All the beginning — letters, digits, slashes and hyphens — remains the same. However, I don’t know how to write this since there are no $ variable. Maybe I could make language codes (en, fr, …) appear as variables.

    Would you please kindly suggest a solution ?

  5. @Christian

    Hm. I think that you are going to have to use multiple redirects to cover this.

    So that string appears at the end of the URL? Ex:

    http://gulati.info/2009/01/using-redirection-plugin-wordpress/lang/en
    =>
    http://gulati.info/2009/01/using-redirection-plugin-wordpress/?lang=en

    Is that the change that you want? You will need a redirect to cover each of the different URL possibilies (ex: the home page, a blog post, etc). A regex could possibly be written that covers all of them, but I’m not good enough with regexes to write it. What is your permalink structure? With that I can give you a list of redirects to add.

  6. Hi Lori,

    Try this:

    Source URL: /(\d*)/(\d*)/(\d*)/([A-Za-z0-9-]*)
    Target URL: http://newdomain.com/$3

    Be sure that you put this on WordPress that is running on the old domain! If you put it on the new domain it won’t do anything. What is your exact situation? Do you have the domains with two different directories/servers, sharing the same directory, the old one isn’t pointed at anything, etc?

  7. I have two questions:

    1. are we supposed to select a module (i.e., wordpress or apache)? If so do we just delete the module not selected?

    2.I want to redirect all posts from: /%category%/%postname%/
    to
    /%postname%/

    Will the URL Monitoring do this automatically when I change the permalink setting or do I need to use a code in the redirection source and target url? If so what code should I use?

    Thanks in advance.

  8. Hi Martijn,

    Here’s a redirection that should work for you:

    Source URL: /(\d*)/(\d*)/([A-Za-z9-0-]*)/comments
    Target URL: /$1/$2/$3/#comments

    Thanks for commenting!

    ——————

    Hi Nancy,

    When you click on ‘Redirection’ on the left bar to get to the plugin, it brings you to the page for the WordPress module and Redirections group. You should make redirections here although I don’t think that it really matters where they are. I wouldn’t delete any modules, though.

    It might automatically redirect and it might not. Some people report that it do and some report that it doesn’t. If it doesn’t, try this:

    Source URL: /([A-Za-z9-0-])/([A-Za-z9-0-])/
    Target URL: /$2/

    Thanks for commenting!

  9. im having troubles with the “modified post” stuff.

    i changed some categories from
    wordpress/category1/post1
    to
    wordpress/category2/post2

    wordpress did it perfectly, in the blog i can see now the links to category2
    but when i click the link, redirection corrects it and becomes again category1. What can i do?

  10. Hi all – this plugin looks like it could solve my problems but I’m too dense to work it out. Plus I’m not a coder so don’t dive into the backend of seo, etc.

    Anyway, I simply need to be able to redirect

    DomainName .com

    to

    www. DomainName .com

    (spaces added in) for everything that is on the site. Will this plugin do that and if so how please?

  11. Hi Everyone,

    I’m trying to do the same thing as another commenter in this thread.

    I have a Google webmaster account and have set my preferred domain to:

    http://www.mydomain.com

    I am currently running wp-supercache and the .htaccess 301 redirect was not working. I believe that this plugin will do the trick, but it has to be stated in plain English.

    visitors are able to reach my site by the following:

    http://mydomain.com

    or http://www.mydomain.com

    I would like to set the http:// to redirect to the www version.

    The first explanation, in this post, showed how to do the complete opposite, but I need clarification on how to do what I prescribed. Help please. Thanks!

  12. Dear Austin

    Thank you for regularly helping out us lost redirect souls. I have a wp blog hosted on a sub domain but I can’t get the source url to recognize that. Everytime I type in subdomain.domain.net, the source url gets changed to domain/subdomain.domain.net. Is there any easier way to solve this issue.

    Warm regard

    Jawwad

  13. hi,

    i changed my permalink structure from

    /%postname%/

    to

    /%postname%-some-added-permanent-text/

    but i couldn’t achieve it to get work…

    tried

    /([A-Za-z9-0-]*)/ to /$1-some-added-permanent-text/ but didn’t work out :(

  14. Hi i am new to wordpress. I am using the wordpress 2.7 version, and trying to install the redirection plugin. When i clicked on the Tools->redirection it will show me the error

    “Fatal error: Call to undefined function esc_attr() in /var/www/html/team01/public_html/newpathweb/wp-content/plugins/redirection/view/admin/item_list.php on line 14″

    Here on the page it clearly mention that, for installing this plugin the wordpress 2.3 or higher version required.

    Please help

    • John-did you add the tplmeate tag into your sidebar?You’ll need to add?php ttlb_ecosystem_details(‘‘); ?Put all that inside a less than and greater than symbol.HTH

  15. Hi, I am having a problem with this plugin. I want to only use one page on my wordpress such as this mydomain.com/p=1 to redirect to another site,
    however the redidrect is now redirecting my main site as well. I just want one page redirecting to another site. Can you help me please?
    thanks
    Paul

    • Hi Mark,

      There is a feature to do this that is described in the article. The directions to set this up are in the article.

  16. Hi, using the plugin, wanting to redirect all posts from http://www.archetypalimages.com/Meta/
    to
    http://www.archetypalimages.com/

    tried using the following example from the plugin website:

    /$1

    This will match any URL that starts with /blog/, and will redirect it to the same URL but without /blog/. For example, /blog/2006/10/01/mypost will be redirected to /2006/10/01/mypost.”>

    not sure if i’m doing it right, cause it’s not working.

    I put “/Meta/(.*)” in the source url, checked Regex, then put “/$1″ in the target url, but it’s still pointing at the original url. It may be important to note that ‘/Meta/’ is a separate install on the same database, and that i’m going to delete it once the redirection works…so i don’t know if that’s effecting the results i’m getting.

    Thanks for the help!!!

    • sorry, the example didn’t post propperly, so here it is, again:

      /blog/(.*) => /$1

      This will match any URL that starts with /blog/, and will redirect it to the same URL but without /blog/. For example, /blog/2006/10/01/mypost will be redirected to /2006/10/01/mypost.

    • Hi Eric,

      If you have two installations or WordPress, which one are you putting the redirection on? It seems that you’re putting it on the wrong one – you want the plugin to be set up on the installation that the source URL would lead to. So the plugin should be installed on the /Meta/ installation.

      • Austin, thanks for the quick reply.

        The situation is, the meta site was merely a temporary install i set up a while back as a test, and i had a dozen or so posts i made there; my main site is on a separate install (under ‘blog’), and so i’ve exported the posts from ‘Meta’, then imported them to ‘blog’.
        Incidentally, ‘blog’ is set up to aim at the root directory so that my urls look like
        http://www.archetypalimages.com/content
        rather than
        http://www.archetypalimages.com/blog/content.

        So, i’ve got the redirect plugin running on the ‘blog’ install. One thing that i experimented with is making the redirect source url ‘meta’ instead of ‘Meta’; in doing so, http://www.archetypalimages.com/meta would redirect properly…so i’m wondering if having the install ‘Meta’ capitalized is causing a problem.

        One other thought i’m having is whether i need to actually delete the ‘Meta’ install before the redirect will work.

        Sorry for such a long and convoluted issue. I appreciate the guidance!

        • Hi Eric,

          First of all, no problem, I’m glad to help.

          Deleting the Meta installation would probably cause the redirection to work. Did you try running the plugin on that installation, though? The plugin should always be running on the installation that controls the source URL, not the target URL. It works for http://www.archetypalimages.com/meta because that is handled by the installation at the root directory which is the one that is running the plugin.

          Try installing the plugin under the Meta installation and see how that works.

          • Ok. I installed it on the ‘Meta’ install, and that worked, like you suggested.

            It does leave me somewhat confused though–i mean, i assume that when someone’s migrating a site they’re gonna delete the one they’re migrating away from…so it seems odd to need to have it installed there. Now that i see it working, though, i’m goanna go ahead and delete ‘Meta’ and see if the redirect on the ‘blog’ works. I’ll let you know how that goes.
            Thanks!

          • Cool. Deleting the ‘Meta’ install took care of it–now everything’s redirecting as it should. Thanks for all the help, Austin! You rock!!!

  17. Hi Austin,

    Glad to see you’re back providing help. The redirection plugin started causing a problem several months ago and I deactivated it. It was only allowing one post on the home page of my blog — and not the latest post – it seemed to be stuck on one post.

    I just upgraded the plugin thinking this would start working, but I have the same problem. I’m on WordPres 3.1.1.

    As you suggested (see Feb 18 & 20, 2010 above)I’ve been using the following code under the redirection tab. The plugin worked fine, then all of a sudden didn’t.

    Source URL: /([A-Za-z9-0-])/([A-Za-z9-0-])/
    Target URL: /$2/

    Thanks for the help,
    Nancy

    • Hi Nancy,

      You may have to put in the specific category names. It would look something like this:

      Source URL: /category-name/([A-Za-z9-0-])/
      Target URL: /$1/

      The reason that you should try this is that a lot of URLs that you don’t want to redirect would be matched by the pattern /([A-Za-z9-0-])/([A-Za-z9-0-])/. You want to restrict it to just the category URLs.

      Let me know how that goes.

  18. Hi Austin,

    I tried your suggestion. It did not work. I also tried it with deleting the /([A-Za-z9-0-])/([A-Za-z9-0-])/ redirection. Same result only one post shows – and not most current.

    Any other suggestions?

    Thanks,
    Nancy

    • Hi Nancy,

      What is the URL of the homepage of your blog? Is it just / or is it /blog/ or something? Either way, I don’t know of a reason that would cause the redirection to cause problems on the homepage of your blog.

      If you’d like, I could take a closer look at your specific blog/situation.

      Thanks! – Austin

  19. Hi! I changed my permalink structure from /archives/123 to /%year%/%monthnum%/%day%/%postname%.html with htaccess mod rewrite:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    It works. But I will try to clear my 404 errors in google webmaster tool. Google is indexed old and new urls. Old gives an error and no redirect automatically to new urls. How to fix it and people can find the information what they searching for.

    • Hi there,

      Try this:

      Source URL: /([A-Za-z0-9-])/feedburner
      Target URL: /$1/feed/

      This will only work if your URLs are like this: /post-url/feedburner. If it is anything else, for example /year/post-url/feedburner, this will have to be modified in order to work.

  20. Hi and thanks Austin for your great support. Here’s my question and thank you very much for any advice:

    Source URL: /index.php/category/post-name/[a number or other text]
    Target URL: /index.php/category/post-name

    example source: index.php/category/post-name/1234
    example target: index.php/category/post-name

    Thank you,

    • Hi there,

      Try this:

      Source URL: /index.php/([a-zA-Z0-9-]*)/([a-zA-Z0-9-]*)/([0-9]*)
      Target URL: /index.php/$1/$2

      Let me know how it goes!

  21. Hi Austin

    I’m struggling to make any sense of this plugin. I’ve read your article above – thank you, and thanks very much for all your work in this rest of this thread! However, I’m still bemused by it all. All about me and my ignorance, and nothing about your excellent writings, I hasten to add!

    I changed my permalinks from the WP default setting to /%post_id%/%postname%/ and ever since, I have had a massive drop in my daily traffic. Just to be completely clear, here is the settings change I made:

    From default: http://theboomtownrap.perthpunk.com/wordpress/?p=123
    To: /%post_id%/%postname%/

    Would you mind spoonfeeding me with a recommendation for what I should put into the Redirection Pugin, please? It’s alarming losing all my traffic like this, and frustrating not to have the technical knowhow to do anything about it.

    Cheers!
    rolanstein

    • Hi rolanstein,

      Are you sure that WordPress isn’t handling this on its own? WordPress automatically redirects old permalinks to new permalinks. Maybe it is just taking some time for search engines to reindex?

      Here’s something you could try:

      Source URL: /?p=([0-9]*)
      Target URL: /$1/

      I’m not sure if that will help very much, though.

      Thanks! – Austin

  22. Hi Austin, How do I redirect a bunch of google 404 errors that look like these urls…I made several permalink changes and trying to fix these.

    Old Url http://tap your feet/.html

    New Url http:/1002/tap your feet/ # the 1002 is the Post_id

    What do I use to make this work…my permalink new is %post_id%/%postname%/
    is this possble…really would appreciate your help…jg

  23. I have been trying to figure this out for past hour and having trouble. I wanted to ask, would you happen to know how i can do the following:

    I am using wordpress.

    If a visitor goes to mydomain.com/testingtest then i want it to redirect to mydomain.com/catagory/contact-us

    Also i want the redirect to be case insensitive.

    For example. If visitor goes to

    mydomain.com/TestingTest
    mydomain.com/Testingtest
    mydomain.com/testingTest
    …etc

    then it would redirect to mydomain.com/catagory/contact-us regardless if its uppercase or lowercase or a mix of uppercase and lowercase.

    I did try using the redirection plugin in wordpress but it does not look like it has a option for the case insensitive.

    i want to do this for many urls so im looking for a good solution.

    Thanks

  24. I just changed my permalinks from the Common Setting Month and name (/2011/11/sample-post/) to the Custom Structure /%postname%/ after reading an article about WordPress SEO. That article also suggests installing Redirect to avoid any “search engine consequences”. I’ve installed it and have tried many of the suggestions you gave to other readers, but nothing seems to work for me. Can you please offer some advice on how to create a new redirect?

    Thanks,

    Andrew

    • I just read the Redirection instructions again and realized that I had to check “regex” for it work. After doing that I noticed it starting to work, but the expressions where still wrong. After a bit of trial and error I final got it working with this:

      Source URL: /(\d*)/(\d*)/([A-Za-z0-9-]*)/

      Target URL: /$3/

      • I just noticed a problem with my solution above. If you try to view the archives for a month (eg: mysite.com/2011/04/) it redirects you to the homepage. If there is a better solution to my problem, please let me know.

        Thanks.

        • Hey Andrew,

          Give this a shot:

          Source URL: /(\d*)/(\d*)/([A-Za-z0-9-]+)/
          Target URL: /$3/

          Your problem is that * means 0 or more and + means 1 or more. So ([A-Za-z0-9-]*) was matching zero or more letters. (([A-Za-z0-9-]+) matches one or more which is what you want.

          Hope that helps.

  25. Hi Austin,

    I read pretty much all the above. I give you an example of an actual webpage I need to redirect:

    http://nbcthevoicefan.com/2011/05/07/javier-colon-time-after-time

    to

    http://nbcthevoicefan.com/javier-colon-time-after-time

    I tried the following (exactly how I entered it into the plugin:

    /(\d*)/(\d*)/(\d*)/([A-Za-z0-9-]*)(/)?
    /$4/

    Top one is the source, bottom one the target URL. However, it won’t redirect the above URL. Any other options?

    Thanks for your help!

  26. Hello and thank you for this great post. It has helped me understand the Redirection plugin much better. I actually have a unique problem I wanted to ask your advice on. My blog is several years old and althought the permalink structure was set at “/%year%/%monthnum%/%day%/%postname%/” some of my older posts showed up like this: http://mywebsite.com/2008/03/05/post-name-%e2%80%93-post-name/ I’m not sure how that part in the middle with the percent signs and numbers got there… maybe its leftover from an older version of WordPress? Those links always worked fine but after I made the changes in Redirection and revised my permalinks to postname all of those old links with the weird format are getting 404 errors (my newer posts are redirecting fine). Any ideas on a code I can insert to redirect those old posts? I tried switching back to my previous permalink structure so I could add the weird links manually into Redirection but all the strange coding is gone now. And I didn’t make note of which old posts had the weird coding so to fix it Redirection may be my only hope!

  27. You can disregard my above post. I was able to identify the old posts with the weird permalink by looking through my archive. I only had about a dozen that needed to be changed manually. On another note, my version of Redirection does not have the two URL monitoring checkboxes as seen in your instructions. Is that from an older version?

  28. Hi Austin,

    I am running a site using WordPress 3.2.1 and downloaded and installed the Redirection plugin. I’ve been doing a ton of reading and can’t figure out how to do something. How do I get people with particular browsers redirected elsewhere? Specifically, I’d like to get mobile Apple users to get bounced to a page in iTunes and Droid based users redirected to an app in the Droid Marketplace.

    Pleeeeeeeease help!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>