Back
RELEASE: Redirect Routing Plugin for Rails
Other·Calvin Correli·Jul 18, 2006· 1 minutes

Here’s another simple plugin hot on the heels of my previous ExceptionTextable plugin: A plugin to add redirects straight in your routes.rb file.

First, to install say:

script/plugin source http://svn.pinds.com/rails/plugins
script/plugin install redirect_routing

Then add this to your routes.rb:

map.redirect '', :controller => 'events'

And now the root of your site will redirect to the index action of the events controller.

Why not just map.connect? Because map.connect causes the URL in the browser to stay at /, which isn’t very RESTful.

Note that you can also pass a string:

map.redirect 'lars', 'http://pinds.com'

Now /lars will redirect to my blog.

See the README for more details. Enjoy!