Redirection
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.
New features include:
- 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
- All URLs can be redirected, including ones outside WordPress
- Redirection methods - redirect based upon login status, redirect to random pages, redirect based upon the referrer!
Existing features include:
- Automatically add a 301 redirection when a post's URL changes
- Manually add 301, 302, and 307 redirections for a WordPress post, or for any other file
- Full regular expression support
- Apache .htaccess is not required - works entirely inside WordPress
- Strip or add www to all your WordPress pages
- Redirect index.php, index.html, and index.htm access
- Redirection statistics telling you how many times a redirection has occurred, when it last happened, who tried to do it, and where they found your URL
- Fully localized
NOTE: If you are upgrading from a previous version then please visit the Redirection options page at least once.
Get the Flash Player to see this movie.
Version History
- 1.7.26 - Fix RSS update and URL encoding problem
- 1.7.25 - Fix database problem on some hosts
- 1.7.24 - Stop problems with mod_security
- 1.7.23 - Stop FTP log files being picked up, RSS 404 log
- 1.7.22 - Allow carats in regex patterns, another FastCGI workaround
- 1.7.21 - Fix activation bug
- 1.7.20 - Workaround for the FastCGI workaround. Hide canonical options for WP2.3
- 1.7.19 - Better database installation, better auto-generation
- 1.7.18 - Add auto-generation for source URL
- 1.7.17 - Add option to disable 404 logs
Installation
Installation is just like any WordPress plugin:
- Download redirection.zip
- Unzip
- Upload to
redirectiondirectory to/wp-content/pluginson 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.
Usage
A redirection is a way for the web server to tell the browser that a particular page is no longer at the current address, and to indicate where it should go to find the new page. The Redirection plugin allows you to create several types of redirections:
- 301 - Permanent redirection and the client should use the new URL in the future
- 302 - Page has been temporaliy moved but the client should continue to use the old URL
- 307 - A HTTP 1.1 version of 302 to disambiguate certain conditions
In addition you can also create specific 404 pages, as well as 'pass-through' pages.
A redirection is created from the Redirection screen in the administration panel:
You can add as many redirections as you want, and redirections will be displayed in a colourful list:
This list can be sorted by any attribute, and can even be manually arranged by dragging and dropping the type. You can save the current order by pressing the 'save order' link. Redirections are processed according to their position, so this will be useful should you require a specific order. You may get a performance benefit by putting your most used redirections at the start of the list.
Pass-Through
Pass-through pages provide the same features as Apache's mod_rewrite, but without requiring either Apache or mod_rewrite, and without requiring .htaccess files. A pass-through URL is a page where the content is retrieved from some other location, but the URL does not change. This other location can be another WordPress post, a file, or even another website.
While you can specify another website as the target for a pass-through page, it should be noted that the contents for this are retrieved by your server, and it is likely that your host will not be very appreciative.
Regular Expressions
Regular expressions can be enabled for all redirections and allow you to specify a pattern, rather than an exact URL. A pattern has the potential to match more than one URL, and so regular expressions give you the ability of reducing a large set of redirected URLs to a small number of patterns.
Explaining regular expressions is beyond the scope of this documentation, and you can find more details elsewhere on the internet.
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
Redirection Methods
Redirection provides ways of adding conditions into a redirection:
- Simple redirection - no special conditions
- Based on login status - redirect to one URL if logged in, and another URL if not
- Based on referrer - redirect to a URL based upon the referring page
- One of several URLs - specify a list of URLs and get redirected to one chosen at random
- Random WordPress post - redirect a randomly chosen post
Redirecting based on referrer
For example, you want to redirect users for /feed/ to /feed2/, unless the user comes from Feedburner. To achieve this you must first create a new redirection item using 'redirect based on referrer'. Once the redirection has been created you can edit it and change the details as follows:
- Source URL -
/feed/ - Referrer -
^feedburner.*$ - Referrer regex - yes
- URL not from referrer -
/feed2/
This sets up a rule whereby if the referrer does not match then the user is redirected to /feed2/, otherwise no redirection occurs.
Logs & 404 errors
Every redirected URL is recorded, along with data about the user that visited it. You can view these logs from the administration pages.
Further log details can be obtained by clicking the date of the log entry. On the 404 error page you can also click the plus icon to copy the URL, ready to create a new redirection.
Options
The options page allows you to configure special features of the Redirection plugin:
- Post slug changes - Automatically create a redirection when a post's URL changes
index.php/index.html- Automatically stripindex.phpandindex.htmlfrom URLs- Root domain - Automatically remove or add '
www' to a URL
Developers
Redirection exposes two WordPress filters, allowing you to add additional redirection events through your own plugins:
redirection_first- Passed the current URL before any other redirectionsredirection_last- Passed the current URL after all other redirections
You can manually redirect, or you can return a Redirection_Item (examination of the code should be sufficient information).
Support
Please direct all support questions to the Redirection support forum. Any support questions left on this page may not be answered.
Bugs & New Features
A full list of all bugs can be found in the Redirection issue tracker.
| Date | Current outstanding bugs | Status |
|---|---|---|
| 23 Jul 2008 | Failed redirection in IE 7 & Safari |
A full list of all requested features can be found in the Redirection feature tracker.
| Date | Current requested features |
|---|---|
| 12 Jul 2008 | Redirection log is massive |






Comments (page 1 of 38)
Aug 8, 2006 5:41 am
The 3rd time was the charm.
The open_basedir error results from PHP attempting to run the included file in the tmp directory instead of the current directory. I've tried mucking around with the apache files to set the basedir, but I have found that retrieving the the current path and appending the included plugin name gets around this issue. Most other plugins use this approach as not al Apache installations are the same.
Mike
Aug 3, 2006 12:09 am
Zip updated again (3rd time's the trick, right?)
Mike, that sounds like a server issue as I'm developing on PHP5 with no errors. Could you possibly send me the output from phpinfo on your server so I can look at the PHP settings and try and replicate it? Thanks
Aug 2, 2006 3:48 pm
I've had the same problem with edit not working.
Additionally you need to change the include directives in redirection.php lines 23 and 461 to
include dirname(__FILE__) . '/redirection_item.php');
Without the directory pathing php5 servers give an open_basedir error.
Aug 2, 2006 4:44 am
Hey, i've tried to update the version, but now i miss some files and the edit function doesn't work at all...
Jul 27, 2006 3:07 pm
I get a recursion error with this plug-in when accessing any URL on my blog. Any chance that this plug-in won't work right with IIS-based hosting? I've had other WordPress plug-in problems related to my host using IIS.
Jul 23, 2006 6:24 pm
Yep, somehow I uploaded an old version of 1.0 from SVN. Updated to the real 1.2 now
Jul 22, 2006 3:40 am
bug report for the redirection.zip file with 21.900 byte filesize (the plugin says it's version 1.0, but according to this web page I've downloaded v1.2): the redirects don't work for changed page slugs, due to one small but silly error.
[technical details removed now it's fixed!]
only due to these changes I was able to get your plugin to work correctly, so I suppose you should update your download zip
Jul 22, 2006 12:02 am
Sorry, I should have made it clear that the plugin is WP 2 only!
Roy, there's a new version, try that and see how it goes. I'm also using it with fucoder's permalink plugin.
Jul 20, 2006 1:04 pm
Not showing up in admin cp after enabling.
Running WP 1.5 here.
Jul 14, 2006 7:09 am
This plugin doesn't work correctly for me. It gives back a 302 instead of a 301, i'm also using the "permalink redirect" plugin, which can be found here: http://fucoder.com/code/permalink-redirect/
have you got any idea what can be the problem?
Leave a comment