You can clone with
Handler 301 is a plugin for Ruby on Rails that lets you easily manage 301 redirections trough a config file.
First, create the config/handler301.yml file and place urls you want to redirect in it :
"product_number_one.html": products_path :id => 1
Then, configure a controller that match non matching routes in your config/routes.rb
ActionController::Routing::Routes.draw do |map|
map.connect "*path", :controller => 'error', :action => 'handle404'
match "*path" => 'error#handle404'
And finally, in your ErrorController (or whatever the name of your non matching routes controller) :
class ErrorController < ApplicationController
unless handle_301(request.path, request.query_parameters)
# Do your stuff here
Last edited by kwi, September 13, 2010