Redirect301 is a MSM compatible plugin that redirects internal links by sending an SEO-friendly 301 header. This tells search engines that your content has moved permanently and avoids penalties for duplicate content.
You can issue a 301 redirect to a new page like this:
{exp:redirect301 url="weblog/template"}
If you’re using the Multiple Site Manager, simply specify the name or ID of your site, like this:
{exp:redirect301 url="weblog/template" site="site_short_name_or_id"}
If you’re using MSM and you don’t specify the site, redirect301 uses the default_site URL to build redirect links.
UPDATED: Version 1.1 now lets you specify an external URL, like this:
{exp:redirect301 url="http://expressionengine.com" external="yes"}
With ‘external=“yes”’, the plugin doesn’t attempt to determine and prepend your site’s URL, so you need the full URL including http://
Use case: short URL system
There are probably several uses for internal 301 redirects, but I’m using it as short URL generator, like this:
1) Create a template group called “go”
2) Edit the index file to include the following code:
{exp:weblog:entries limit="1" entry_id="{segment_2}" disable="member_data|trackbacks|pagination"}
{exp:redirect301 url="{weblog}/{url_title}"}
{/exp:weblog:entries}
This will take a URL such as http://yoursite.com/go/33/ and issue a 301 redirect to the full URL, such as http://yoursite.com/compliments/you-look-nice-today/
Then, to create a link within your posts that readers can share, simply append the post ID to the short URL address, like this:
{exp:weblog:entries}
<a href="{site_url}go/{entry_id}/">Short URL</a>
{/exp:weblog:entries}
Optionally, you can add the following code between your <head> tags to help third-party services such as AppSpot’s Revcanonical to determine that you’ve published a short URL. This is good practise but isn’t required for the redirect to work.
{exp:weblog:entries}
<link rev="canonical" rel="alternate shorter" href="{site_url}go/{entry_id}" />
{/exp:weblog:entries}
Hope it helps some folks. Your thoughts and suggestions are very welcome.
