→ bounce

06 April 2008

You want to redirect your old url (/repositories/search) to your new one (/search).

At the top of your routes file:

map.with_options :controller => 'site', :action => 'bounce' do |bounce|
  bounce.connect '/repositories/search', :to => '/search'
end

Your controller:

class SiteController < ApplicationController
  def bounce
    redirect_to params[:to], :status => 301
  end
end

Simple. Add as many more bounces as you need.