This page is now deprecated. Please visit the Redirection plugin website

Redirection is a WordPress plugin to manage 301 redirections, keep track of 404 errors, and generally tidy up any loose ends your site may have. This is particularly useful if you are migrating pages from an old website, or are changing the directory of your WordPress installation.

Features include:

  • Supports both WordPress-based and Apache-based redirections
  • 404 error monitoring – captures a log of 404 errors and allows you to easily map these to 301 redirects
  • RSS feed for 404 errors
  • Custom ‘pass-through’ redirections allowing you to pass a URL through to another page, file, or website.
  • Full logs for all redirected URLs
  • Create redirections based upon a URL, browser, referring site, or login status
  • Automatically add a 301 redirection when a post’s URL changes
  • Full regular expression support
  • Fully localized
  • Export all redirections to CSV, XML, or Apache .htaccess files
  • Import Apache .htacces files

Redirection is available in the following languages:

If you can provide a language translation then please get in touch. A PO file is provided with the plugin to be used in translating with poEdit.


Installation is just like any WordPress plugin:

  • Download
  • Unzip
  • Upload to redirection directory to /wp-content/plugins on your server
  • Activate the plugin
  • Configure options from Manage – Redirection

Note that you must have a permalinks structure setup through WordPress.

You can find full details of installing a plugin on the plugin installation page.

Core Concepts

Redirection uses three core concepts:

  • Modules
  • Groups
  • Redirects

A module consists of many groups, and each group consists of many redirections. A module determines how the redirections will be used, and a group allows you to separate redirections into logical units. A redirection represents an action performed when a particular URL is accessed.

Don’t worry, there’s more to come!


At the most basic level, a module determines how redirections are implemented. There are three types of module:

  • WordPress
  • Apache
  • 404 errors

The WordPress module uses WordPress to implement redirections. This means it works for all permalink-enabled sites and so has the greatest compatibility.

The Apache module, as you would expect, uses Apache to implement redirections. This means that each redirection is written to an Apache .htaccess file, giving you better performance than the WordPress module, at the cost of less compatibility and less flexibility (some features, such as redirection statistics, are only available from the WordPress module).

Separate from these is the 404 error module. This uses Redirection to keep track of 404 errors.


Each module can be exported to CSV, XML, or an Apache .htaccess file. You can also view logs for each module via an RSS feed

WordPress Module

The WordPress module is the default module and provides the most features. The main disadvantage of this module is that each time a URL is redirected it requires WordPress to be loaded (contrast this to the Apache module where a redirection occurs before WordPress loads).

This module is configured as follows:

Wordpress Module

These options are detailed below:

  • Canonical – determine whether the www should be removed or added to your site URL.
  • Strip index – if enabled then any attempt to access a index.php, index.html, or index.asp file will cause an automatic redirection to the same URL, minus the index file.
  • Time Limit – sets a site-wide PHP timeout limit. Useful if something is timing out.
  • Error level – sets the PHP error reporting level. Useful for removing unwanted warnings, or for viewing hidden ones

Apache Module

Rather than using WordPress to provide redirections the Apache module writes data to an Apache .htaccess file. If you site supports these then this will give you the greatest performance, at the cost of losing a few items of functionality. For example, the Apache module provides no statistical information so it is not possible for the Redirection plugin to keep track of how many times a particular redirection has been used.

The module is configured as follows:

Apache Module

The options that differ from the WordPress module are:

  • Location – the location of the .htaccess file. The default will be your site directory
  • Ban IPs – prevents certain IPs from accessing your site
  • Allow IPs – allow certain IPs to access your site
  • Raw .htaccess – add custom rules
  • Site URL – an advanced option which allows you to set the site base URL

Note that when writing to a .htaccess file the Apache module will retain any existing non-WordPress data, so you can still add custom rules.

404 Module

This module is a little different to the others in that it is designed to record 404 errors. Rather than make this a general function, as in previous versions, the power of this module comes from the fact that redirections created inside it will be ignored from the 404 log. In other words, the module records all 404 errors except the specified URLs. Combined with the RSS feed this gives you a lot of options to keep track of errors on your site.

404 Errors

If you do want to ignore a 404 error (for example, you site may not have a favicon.ico and you don’t want this recorded) then you should create redirections as normal, but set the action to ‘Do nothing’. As for other modules you can create redirections based upon any action or rule, or matching a particular regular expression.


A group is a logical collection of redirected URLs. You can create as many groups as you wish, and groups can be re-ordered. URLs are matched based not only on the order in which they occur within a group, but the order in which groups occur within a module.

Group Edit

As well as allowing you to collect redirections together, you can also specify whether the redirections within a group are logged.

As an additional configuration option you can select which group an automatically generated URL is put in when a post/page or category is changed.

Using Redirection

The main idea behind Redirection is that you create several URLs that you want to redirect. These URLs are placed within a group, which in turn is placed within a module. The module determines how the URLs are redirected, and the group allows you to logically organise the URLs.

Each URL (or redirection) can be configured to behave in different ways. When creating a redirection there are several pieces of information you must provide:

  • Source URL – This is the original URL that you want to redirect somewhere else
  • Match – This tells the plugin how you want to match the source URL
  • Action – Determines what happens if the URL is matched
  • Regular expression – Tells the plugin that the source URL is a regular expression (i.e. a pattern that may match many URLs)
  • Target URL – most actions have a target URL. This is typically the URL that the user will be redirected to should the pattern match


Note that items can be re-ordered and this may influence which redirection takes effect.

Matching URLs

Matching a URL is a key part of Redirection and consists of a source URL. This URL must exactly match a URL that you want to redirect. For example, your site has the page:

The source URL for this is: /oldpage/that/needs/redirecting/. The source does not require your website address, and it is only possible to redirect a URL that exists on your website (you cannot redirect an external website, for example).

Advanced users can make use of regular expressions to reduce the number of redirections they need to create. A regular expression is basically a pattern that tells the plugin how to match. For example:


This pattern tells the plugin that you want to match a URL that looks like:


That is, the (d*) indicates a number, and the (.*) a sequence of characters. Regular expressions are a complicated subject and this page will not attempt to give more than a passing overview of using them. If you do need more help then you should take a look at a regular expression website.

Remember that if the source URL is a regular expression then you must enable the regular expression option, otherwise Redirection will just treat you source URL as plain text.

In addition to the source URL you can also specify a match condition:

  • URL only – Only matches the URL (the majority of your redirections will use this)
  • URL and referrer – Matches a URL when the source and referring site matches (i.e. match the URL only when the user came from a certain website)
  • URL and login status – Matches a URL when the source and user’s login status matches (i.e. match the URL only when the user is logged in)
  • URL and user agent – Matches a URL when the source and user’s browser matches (i.e. when the user is using a particular type of web browser)

These special rules can be both positive and negative. For example, you can match a URL when the user is logged in (and be redirect to one URL), or when the user is not logged in (and be redirected to another URL). This makes it very easy to create custom rules where users are redirected if they are using a particular browser, or if they came from a particular website.


An action tells Redirection what to do when a source URL is matched:

  • Redirect to URL – The default case and the majority of your redirections will use this
  • Redirect to random post – An esoteric action that may be useful to some people
  • Pass through – An advanced option that allows you to masquerade one URL as another (i.e. when the source URL is accessed it actually displays the contents of another URL without the user being aware)
  • Error (404) – Causes a 404 error to be returned
  • Do nothing – A dummy option that can be used if you just want to track accesses to a URL

Configuration of rules and actions

Depending on the particular combination of action and match rule you may be required to provide further details for a redirection.

Basic URL redirection

You can specify which HTTP code is used to redirect a URL (301, 302, or 307):

Redirect Url

A couple of examples:

/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.

/2006/month_(\d+)/(.*) => /2006/$1/$2

This will match any URL that starts /2006/month_, and is then followed by a number. This will be redirected to the same URL, but without month_. For example, /2006/month_1/something will be redirected to /2006/1/something.

To replace a single dash in a URL with a space:

/tags/(.*?)-(.*?) => /tags/$1%20$2

Redirect to URL by matching user agent

This allows you to configure a redirection to occur when a specific browser (the user agent) is used:

Redirect User Agent

A set of pre-defined user agents is available from the drop-down menu or you can specify your own. The user agent match is always performed using a regular expression.

Two target URLs can be specified, one for if the user agent does match, and one for if it doesn’t match.

Redirect to URL by matching referrer

Similar to the user agent rule but this one looks at the referrer. That is, if a user follows a link from another site to yours, the original site is passed along by the browser (unless disabled) to your site so that you know where the user came from. Using this rule you can base your redirections upon this original site.

Redirect to URL by login status

This rule allows you to match a URL based upon the user’s WordPress login status. That is, if they are logged into your site.

Support & Bugs

Support and feature requests should be made through the Redirection support forum. You can contact me directly but I spend a very limited amount of time on direct support and you stand a better chance of being answered through the forum.

If you find the plugin useful then please do consider making a donation – it is appreciated and helps towards the maintenance of the plugin.


1,340 thoughts on “Redirection”

  1. OK, just holy shit. This is the best plugin I have come across yet. I have been trying to do a simple redirect from a subdomain to a totally different domain for quite sometime, but it just wouldn’t work using the .htaccess for some reason. I downloaded this plugin, typed in the regex and BAM! It works like a charm.

    Thanks for the plugin, definitely going to pimp this one.

  2. Hello,

    I wonder, does that plugin affect the URLs BEFORE or AFTER a search engine robot browses our blog ?

    In other words, I am wondering to what extent it can be used for SEO purposes 😉

    Thank you very much if you can tell me,


  3. Thanks for sharing this. I recently looked at my server logs and noticed that a large number of users were linking to an post slug that had been changed. In a few easy steps, Redirection allowed me to redirect users to the new post URL. This was exactly what I was searching for; I don’t need to manage the .htaccess file directly. Brilliant!

  4. […] We are going to need a forum around here quite soon. From what I can see tech support for serious plugins is so messy in comments. Mark’s at 3000 odd for the excellent Subscribe to Comments and John’s at 301 (ironically enough) for the fine Redirection. […]

  5. I ended up having great success using your plug-in, so thanks for that! Now, I’m wondering: I have a large number of posts that I want to migrate from one WP installation to another, and I will want to redirect from the old to the new addresses. What are your thoughts on functionality that would allow one to create a .txt or .csv file that include all the needed redirect info — old address, new address, etc. — and simply import it for your plug-in, avoiding the need to manually enter each one?

  6. The redirection tab won’t show up in the ‘manage’ section but it can be enabled in plugin screen.
    Does it work with wp 2.2.1 actually?
    I am quite annoyed by broken links showing in google searches.

  7. The redirection does not appear to word on XP and IE 6. Really weird. It works perfectly on my mac, and was unaware until a PC user pointed it out to me and he’s right.. it just does not work.

    All I get it page not found. Real bummer as this was EXACTLY what I was looking for!

    Instead I have to use your other User Permission plugin to hide the page that unregistered users can’t visit.. there is no message that happens then.. it just kicks the person back to the home page… and they think something is wrong.

    Any idea why it won’t work on IIS, WP 2.3.1 and XP and IE 6?



  8. Never mind. It still doesn’t work for me.. but I realized that you other plugin User Permissions has an option to redirect a person to another page if they are not logged in.. which is EXACTLY what I wanted.

    Thanks for making great plugins!


  9. I think I may have found a serious issue with this plugin. I have the latest version 1.7.26 but also tried with 1.7.22.

    I used this header checker:

    ALL PAGES THAT ARE 404 GIVE A 302 RETURN CODE, even with the 404 log disabled (standard options)

    This is obviously not very good SEO wise. Is this how the program was designed to work?

  10. Hi.

    I keep getting this problem. Can you please tell me what’s the case? When I turn on plugin can’t even open pages on blog and that error comes up:

    "Fatal error: Cannot redeclare class re_database in …blog/wp-content/plugins/redirection/models/database.php on line 4"

    And happy new year!

  11. Sorry, i have this eroor when enabling thje plugin:
    Warning: Invalid argument supplied for foreach() in /mnt/157/sda/a/f/barratj/wp-content/plugins/redirection/models/redirector.php on line 87
    I’m in WordPress 2.3.2, thank you for your help your plugin looks very interresting.

  12. […] not the aging project in my portfolio. The WordPress plugin for managing .htaccess rules without cringing in horror, or wondering whether they’re actually working. my first stabs at […]

  13. A new version of Redirection will be released very soon and I’m currently looking for people to beta-test it. The changes are substantial, and it should also fix all reported problems. If you can help then read this for more details.

    Albert, that’s not possible with Redirection as it has no knowledge of your categories to know how to redirect. You could add a redirection for every post you have, but this would be a lot of work. A better solution would be to look at Advanced Permalinks and migrate your old permalink structure.

  14. It would be nice if redirection logs could be toggled off an on without having to disable 404 error logs or disable the plugin itself. My redirection logs approach hundreds of entries plenty quickly, sometimes in a day or two, it seems like if I forget it about it for a while they are going to start taking up serious server space, kinda like that cron job you forgot about and dont need anymore or 3rd party stat plugins (except WordPress)

    In any case, thanks for a great plugin, its been very useful lately.

  15. BUG?

    Regex in source URL wouldn’t let me enter ‘+’ sign (for 1 or more matches). when i save it – it always replaces ‘+’ with space…


  16. BUG#2:
    I tried to avoid using ‘+’ with {1,} regex construct – but this one doesn’t seems to work either. Not sure how can i create matching expression now to match one or more preceding characters….


  17. I am new to Redirects and your Redirection plugin. I got it installed fine, but I really don’t know what I should do on the Options page. Do you have more info posted about this somewhere?

    Like for the ‘Create 301 when post slug changes:’ I am guessing that is a good thing and should be checked marked. And same for "Redirect index.php/index.html:". I checked marked that too.

    Now on "Root domain" I am not sure. I have "no www" picked at google, so do I also pick (Strip www) here too?

    ‘Auto-generate URL:’, ‘Globally redirect unknown 404 errors:’, ‘IP Lookup Service:’ I don’t have a clue what these are for.

    I check marked both: ‘Log 404 errors:’ and ‘Check for updates:’ guessing that they are good things to do.

    Can you give me and other newbies like me a link to where we can find more info on this. Thanks!

  18. […] Redirection: Il plugin ci permette di fare redirect da alcune pagine del nostro blog verso altre. Il plugin permette di scegliere tra 4 metodi di redirect e 5 tipi di redirect. In questo blog il plugin viene usato per redirectare gli utenti che accedono alla pagina directory verso la home della directory. […]

  19. Hi John! First of all, very useful plugin. I tell you that I’m on 2.3.2 version of WordPress: I’m not sure if your plugin works perfectly on this version. I had non problem during the istallation and setting options. However, after setting a new redirection (I set: ‘Source URL:/php5/wordpress/download-old’ and ‘Target URL:/php5/wordpress/download’), when I write in the Address Bar (with Firefox) ‘…/php5/wordpress/download-old’ just for testing, it takes me to that page and it seems that Redirection Plugin doesn’t work at all! How can it be possible? Do you think that there’s something that I missed? You haven’t specified: is there something particular (such as other plugin) that I need to make Redirection Plugin work? Thanks in advance!

  20. Regular Expressions; could you give us a few of the basic ones most commonly needed for word press?
    Like the one to change this…
    to this:

  21. What is the ‘%5c’ at the end of this URL mean?


    When I put in the new target URL do I leave that ‘%5c’ at the end?
    Like this:


  22. Wige on the fourm answered my question…

    Regular Expressions for word press
    Like the one to change this…
    to this:

    Easy enough…

    /blog/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*) becomes /blog/$4

    [0-9]{4} matches any group of 4 numbers, [0-9]{2} matches any group of two numbers, and .* matches any grouping of characters. Everything enclosed in () is assigned to a variable, so since the only part you are keeping is the fourth one, use $4 in the expression to use that value.

  23. How do you edit a redirection once it’s been created? I’m trying to modify a redirection based on a referrer but can find no way to do this, despite what the above directions say. No mechanism for editing appears to exist!

    I also have a problem deleting individual directions. The little "-" exists on the right of the redirection, but clicking it does nothing, even after a page refresh.

  24. I am still clueless on how to set up this redirection, can anyone help me?

    Lets say my blog is

    I will have many different authors writing for that blog and occasionally they may post a link within their
    blog post like this:

    but every time a visitor clicks on the above url I want it to go to :⊂=EG

    Can anyone key me in on exactly what I need to put where? and which options I need to select?

    source url: ?
    target url: ?

    type: ?
    method: ?

    regex: checked or unchecked?

    and any specific settings in OPTIONS tab that would need to be set?


  25. >Is this WP Plugin compatible with WordPress 2.3.2

    I am using it on WordPress 2.3.2 and it seems to be working fine from what little I know. Still not sure about what I am doing or should be doing with it. Wish someone that understood this plugin well would give us some tips on using it – or should I say, tips on using it the right way. And please hold our hand and walk us step by baby step to the land of milk and honey and no 404 pages. Thanks!

  26. […] たとえば、投稿した記事、ページを違うページで表示したいけど、直接、そのページ元は見られたくないときにも利用できます。 まず、「Redirection」からダウンロードし、解凍します。 […]

  27. I cant remove or add anything from the 404 log. The plus/minus buttons are not working, they are linked to a "#" so nothing happens when clicking.

    The same happens in other list where these buttons are present…

    It’s a very annoying problem because I cant remove any redirection previously created and not needed now.

    Any fix for this?.

  28. I’ve added the remaining issues to the Redirection bug tracker. Please bear in mind that a lot of problems have already been fixed in the unreleased Redirection 2.0, which is still undergoing beta-testing. If you’re interested in trying out the new version then register and you can download the latest version.

    Joni, the new version will have updated documentation. Many of the options you mentioned have been relocated and hopefully made easier to understand. The %5c at the end of your URL looks like it shouldn’t be there – where did it come from?

    Greg, you don’t need anything else to run the plugin. Can you raise a bug report and provide more information about your site (for example, what the blog and site URL is)

    Dexter, yes it’s compatible with WP 2.0+

    DLE you edit a redirection by clicking on the URL

    Tom, for the example you gave you would need to create a standard 301 redirection as follows:

    Source URL: /expert/spirituality-religion/love-relationship/nickdutch/
    Target URL:⊂=EG

    No regex, no additional configuration.

  29. Thanks for the reply John and your help,

    but the problem still is the source URL.

    If I enter /expert/spirituality-religion/love-relationship/nickdutch/

    into the source url box, it appends that extenstion to the domain name of my site,
    for example when I hover over the extension in the redirection section of wordpress it looks like this:

    the problem is, I want all links that are listed within blog posts that look like this:

    to redirect to this:

    does the source url always have to have my site domain as the root?

    or put another way, is it possible in the source URL box to have the root domain name be one that is not my own blog?

  30. Tom, it’s not possible using Redirection, or anything else, to redirect URLs for another domain (the are some black-hat techniques you can use with JavaScript to try and do this, but it’s not recommended). The best thing you can do is to put the redirections on the kasamba website.

  31. Pingback: Webmaster Forum
  32. Awesome plugin John, I’ve been looking for something like this to help redirect my links because of custom query strings in my pages (using ExecPHP)… Standard WP Permalinks + Custom PHP code make for some ugly ass urls…



    Now with your plugin and some regex, I’m all set. Cheers!

  33. Thanks for a fantastic plugin! Redirection is great. It really
    eased our migration to a new link structure and has since become
    almost an essential WordPress tool. One feature request I have for
    a future release: Could you add the ability to “batch edit” the 404
    errors, (like “Mass Edit Mode” does for managing comments)? This
    would make a quick and easy way to wipe out redundant errors
    without blowing away the whole list. Thanks again! Great plugin! ~R

  34. From the redirection page I get the error

    Fatal error: Undefined class name ‘re_log’ in /home/.gromyko/defiantone/ on line 23

    From the log page I get the error

    Fatal error: Undefined class name ‘re_log’ in /home/.gromyko/defiantone/ on line 257

    From the 404 Log page I get the error

    Fatal error: Undefined class name ‘re_log’ in /home/.gromyko/defiantone/ on line 285

    I’m not great at this – I install and hope that it runs correctly – any ideas?


  35. Hi John! I should say it is a wonderful plugin but I am confused. We can redirect to different URLs under the same domain??

    What if I have a domain say and I am moving to a new webhost and new domain name but I want to preserve the search engine rank.

    So can I redirect to or ??

    I think I am complicating stuff here but I am stuck figuring out the right way to do it?? I am sure I have to register both and under the new web-host. Do I still need to have the same posts in both the blogs for an interruption free experience for my users without losing the pagerank on Google?

  36. Pingback: Quasi.Me › 301
  37. first of all . Greatest and powerfull plugin ever. Best feature ist works without apache mod_rewrite. I love this software 🙂 Im using version 1.7.26. But I have a little question.
    In the redirection options exists a option add www to root domain.
    My question is : is it possible to add subdomain prefix to domainname dynamicly? with pass-throug method?
    maybe someone can send me code to workarround.
    my actual problem is. i created a subdomain.
    lets say
    if i type in the url my wp redirects to but for seo it should hold
    of course same procedure should work with www so should hold
    i need a dynamic solution. this means all subdomains needed to pass-throug to use one blog for all dubdomains but holding the subdomain url in response.
    any tips out there? best regards.

    best regards.

  38. My question is the opposite of some other people.

    I want any inbound URL, except index, that does not have a slash to be forwarded. So, for instance


    would forward to


    but a request for


    Would be left alone.

    I can write an actual regex that does this, such as ‘^/([a-zA-Z0-9\-\_]+)$’, but nothing I enter into Redireciton seems to take.

    Any ideas?

  39. You saved my life. 🙂
    I ended up changing the structure of my permalinks recently, because of some problem. Fortunately, I had just two posts so far, and your plugin came in very handy to fix those two permalinks which were constantly getting 404 errors.

    Thanks for the great work!

    – Sudhanshu

  40. […] would suggest Shankar to migrate all of his tech related posts to his new blog. Put a 301 redirection on the previous blog. That will repair some of the damage. Given that he has a good domain name, I […]

  41. I can’t redirect my feed to FeedBurner!!!

    HTTP Error Code: 500

    Detail: There was a problem retrieving the feed: com.burningdoor.rsspp.resource.impl.HttpConnectionException: Error getting URL: 400 – Recursive feed redirection error: Are requests for your ‘Original Feed’ address — the feed that FeedBurner is checking for updates — being redirected to your FeedBurner feed? Make sure your Original Feed is provided from a web address that isn’t redirected to FeedBurner.

Comments are closed.