Redirection

Jun 26, 2006 | Tags: , , , , , | Written by Administrator

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

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:

Create

You can add as many redirections as you want, and redirections will be displayed in a colourful list:

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.

Logs

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:

Options
  • Post slug changes - Automatically create a redirection when a post's URL changes
  • index.php/index.html - Automatically strip index.php and index.html from 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 redirections
  • redirection_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
Share This

Comments (page 30 of 38)

  1. author
    Fini :

    Dec 6, 2007 10:52 am

    1.7.26 does not work with WordPress MU 1.3 (WPMU), after activating plugin, the plugin page does not work, and you have to delete the plugin to disable it again.

    After activating you can go to the Redirector options page, and see tabs in top, but all pages are blank.

    Also for WPMU would i need to use it on all sites individually or could i control all redirection from the main blog?

    This plugins features rocks so much! And I need it bad ;)

  2. author
    Shanta :

    Dec 1, 2007 8:53 am

    Is there a simple way to delete a single redirection that I no longer need? Clicking the red minus symbol next to the redirection does not do anything. Thank you for your help.

  3. joiz :

    Nov 30, 2007 9:36 am

    Hey there, I really love this plugin, it keeps track of 404s and redirects work nicely except when I'm redirecting based on referrer, I'm trying to redirect the feed to a feedburner url if it's a human reader but when I try editing the redirect, it always says "service temporarily unavailable". Can anyone suggest how I could fix this? Thanks in advance :)

  4. Joel Wideman :

    Nov 29, 2007 10:33 am

    I'm trying to get it to redirect my /gallery2 to /wpg2 and it simply doesn't work. It tracks 404s just fine, but that's it.

  5. RT Cunningham :

    Nov 28, 2007 12:17 am

    How would I trim off the last part of this URL. Some retarded search engine (Yahoo Slurp I think) is hitting my site with all the URLs like this:

    http://www.untwistedvortex.com/2007/09/20/blog-drive-bys-for-2007-09-20/Untwisted%20Vortex/ (the %20 appears as a space in the log).

    This has been going on for over a month. I want to help them move on.

  6. John (author) :

    Nov 27, 2007 1:00 am

    Any change to a post's slug from the edit page will result in a redirection being created. So yes, if you change a post's category from the edit page and that results in a new slug then it should be captured.

  7. author
    ovidiu :

    Nov 26, 2007 3:19 am

    hello, my question might sound a little dumb, but you state it creates a redirection when the slug changes, does this also catches when en editor moves a post to another category?
    I have had lots of such errors from google bots, when the bot came looking for an article that had moved into another category.

  8. John (author) :

    Nov 25, 2007 9:55 pm

    Marco, fixed in latest release

  9. Marco Luthe :

    Nov 24, 2007 4:05 am

    I think there is a little problem with your plugin.

    If I add a new redirection and write an absolute address beginning with "http://" (e.g. http://ww.saphod.net) into the field for the target URL, it is fine at first - but if I edit that redirection, it is somehow masked into e.g. http%3A//www.saphod.net (the ":" is changed into "%3A") which makes the redirect go wrong. Apart from that, it's a nice plugin.

  10. CJ :

    Nov 21, 2007 12:18 am

    This is such a superb plugin.

    There are so many people sratching their heads trying to edit their .htaccess files. Or trawling through FeedBurner support forums trying to sort out their RSS feeds.

    This plugin does it all in one easy-to-use and well documented solution.

    Donation coming your way!

    CJ

Leave a comment


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

Home | Software | Terms & Conditions | Sitemap | John Godley © 2008
Close
E-mail It