Redirect, a simple Ruby redirect DSL build on Rack
Posted by petrik on Feb 19, 2009
Just released another small gem called Redirect for doing quick redirects.
Example
Create a file and pass an array to the redirect method:
require 'redirect'
redirect ['/catch_url', '/redirect_url'],
['/catch_url2', '/redirect_url2',
{:code => 307, :name => 'redirect link'}],
['^/some_regexp', '/all']
The catch_url can be a regular expression. You can overwrite the default 301 http code in the options.
The default redirect code can be changed:
Redirect.default_code = 307
A sitemap.xml is generated for all redirects that have a name.