Usage
Basic Redirect
The most basic type of redirect is by adding an original URL and new URL.
For example, lets say you've just redesigned your site with ExpressionEngine and you have a bunch of URLs you have to redirect. Instead of messing around with an .htaccess file, you can easily add these to Detour Pro and be on your way.
Let's say you moved the following file:
x.com/my/old/file.html
To this file:
x.com/seo/friendly/goodness
You can simply add:
Editing Existing Detours
To edit a detour, click on the "URL String to Match" name and you will be able to edit all fields.
Redirection Methods
For each Detour you can select the redirect method, either 301 or 302.
301 is a permanent redirect. You would use this when you remove a page and don't plan to ever need it again.
302 is a temporary redirect. You would use this for pages that may have temporarily moved but will come back later.
An example of some temporary redirect use-cases would be:
- Redirecting your homepage to a maintenance page
- Redirecting to a "Closed for the Season" page
- Redirecting to a "No Vacancy" or "Sold Out" page
For some more information, check out this SEO Moz article: Redirection
Start and End Dates
Start Date and End Date allow you to create Detours that are only active during the timeframe between the Start Date and End Date.
This is helpful for many reasons; for example, lets say you want to set up a redirect to only be active in the month of March. You can select March 1st as the Start Date and March 31st as the End Date. If a user visits that page on February 28th, they won't be redirected, but if they visit on March 13th, they will.
This is critical if you're running a promotion and don't want to mess with changing templates, remembering to switch them back, keeping old copies so you can re-enable it at a later time, etc.
Start Date and End Date can be used independently of each other so you can have Detours that:
- Start Date Only: Start on a certain date and are available forever thereafter
- End Date Only: Are available immediately but end on a certain date and are no longer available
- Both: Are available only during the timeframe between the Start and End dates
Using just a Start Date is good if you want to set up your templates now and have them trigger redirects on a certain date in the future.
End Date is useful if you want to "expire" a redirect that you might use again later.
To remove a Start Date or End Date, click on the "URL String to Match" to get to the "Edit Detour" page and simply delete the text in the corresponding field. A calendar widget will pop up when you click on the field, you can ignore that and delete the text anyway.
Redirecting with Query Strings
If you are attempting to redirect URLs with query strings, such as:
http://x.com/path/file.php?id=1&foo=bar
And you are not having luck, go to the Detour Pro settings. You will see a setting for "Default URL Detection Method".
If your server supports PHP redirection, you will have an option for PHP: $_SERVER['REQUEST_URI']
Select that option, save your settings, and try again.
Wildcard Redirect ( % )
Another great feature is the wildcard. This type of redirect will detour ALL traffic from any URL that matches up to the wildcard (%) to a new location.
For example, if you want to redirect BOTH of the following URLs:
http://x.com/blog/my-entry
http://x.com/blog/another-entry
To the following URL:
http://x.com/newblog
You would create the following Detour:
NOTE: This does NOT pass anything to the new URL
(i.e. /blog/my-entry will NOT redirect to /blog/newblog/my-entry)
To pass the non-matching portion, use the "Wildcard Redirect with Segment Replacement ( %% )"
You can also use the % symbol on both the front and back of segments to match the text ANYWHERE in the URL.
For example, lets say you want to redirect a URL with the word "contact" anywhere in the URL:
http://x.com/old/contact.html
http://x.com/contact/form.html
http://x.com/best_ways_to_contact_us.html
To the following URL:
http://x.com/new/contact-us
You would create the following Detour:
Wildcard Redirect with Segment Replacement ( %% )
Building further on the Wildcard Redirect, you can also do a redirect with segment replacement. This is useful if part of your segment or directory structure changes.
For example, you want to move:
http://x.com/blog/my_article
Over to this URL:
http://x.com/newblog/my_article
You would create the following Detour:
You can also use the %% symbols on both the front and back of segments as well.
Lets say you changed your "contact" page URL from:
http://x.com/about/contact/form
To this URL:
http://x.com/about/contact-us/form
You would create the following Detour:
Be Careful!
Using wildcard redirects with segment replacement can create a redirect loop. Use caution if you're not sure what you're doing here!
Combining Wildcards
You can also mix and match the single ( % ) and double ( %% ) percent symbols to create all kinds of redirects.
In this example, if you want to remove the preceding segments of the string and keep the trailing segments from this URL:
http://x.com/about/contact/form
And redirect the user to this URL:
http://x.com/contact-us/form
You would create the following Detour:
Another example would be if you wanted to keep the preceding segments of the string and remove the trailing segments from this URL:
http://x.com/keep/this/remove/this
And redirect the user to this URL:
http://x.com/keep/this/new/section
You would create the following Detour:
Remember
Parts of the URL that match %% will STAY and parts that match % are REMOVED.