Notice: I no longer maintain this site regularly. While some content is still relevant, most of it will be migrated to my company site soon. To see what I'm up to go to focuslabllc.com.


Redirect Helper Lite
Documentation

Always do a database backup before performing upgrades, downgrades and installations to add-ons.


Requirements

  • ExpressionEngine 1.6.8
  • PHP 5.2

Installation

  • Copy the system/modules/redirect_helper_lite directory to your system/modules directory
  • Copy the system/extensions/ext.redirect_helper_lite_ext.php file to your system/extensions directory
  • Install the Module in the Control Panel, this will also install the extension
  • Create new redirects for your site

Upgrading from 1.0.1 or earlier

  • Version 1.1.0 introduces a companion extension file that also needs to be enabled under your Extensions Manager

Generating Destination Links

CP Screenshot

When adding and editing redirects you have the option to select an existing entry from your site. This will automatically generate the Destination for you so you do not have to type it out. It is based on the Weblog Paths setup in your respective Weblog Preferences. If you have a Comment URL defined it will use that path. If no Comment URL is present then it will default to the Weblog URL. If your entry is within either the Pages or Structure module these path settings are not used.

Module Tags

Note: This tag still works in version 1.1.0 but is no longer necessary due to the addition of the extension. You can remove all instances of the tag and the Module will still work. This also give you native functionality back with EE's {redirect} tag.

Essentially there is only one tag for the Lite version of Redirect Helper. Your site will not actually use any of the saved redirects unless this tag is present in the template that is loaded. I use the redirection for a number of purposes so I just keep this tag in my head above my DOCTYPE. The tag is:

{exp:redirect_helper_lite} 

Replacing EE's Native {redirect=""} Tag

If you use a standard EE redirect tag on a template you will need to change that to use this module’s redirect tag so that your custom URI redirects still work. The default {redirect=’’} tags are parsed before the module is run thus preventing full redirect matching. Example change:

{redirect=”blog/index”}

// would change to

{exp:redirect_helper_lite dest=”blog/index”} 

Using Cookies

Each time someone lands on a Redirect Helper redirect URL a cookie is stored with the name and string of the redirect. The cookie is relative to your cookie prefix which by default is "exp_". Here's an example of how you might use it in a template assuming you have PHP enabled in the template:

<?php

global $PREFS;
$prefix = ( ! $PREFS->ini('cookie_prefix') ) ? 'exp_' $PREFS->ini('cookie_prefix').'_';
$redirect = (isset($_COOKIE[$prefix.'redirect_name'])) ? $_COOKIE[$prefix.'redirect_name''No Redirect Used' ;

?>

<!-- beginning of conversion form elements would be here -->

<
input type="hidden" name="campaign" value="<?=$redirect?>id="campaign" />

<!-- 
completion of conversion form -->