今更ですが。。
参考
Rails 3.0 rescue from Routing Error Solution
2.3系は下記でやっていました。
存在しないpathを指定した際に404を出力させる方法 - うんたらかんたらRuby - Rubyist
3系では
route.rb
match '*a', :to => 'errors#routing'
としておくと、
Started GET "/hoge" for 127.0.0.1 at 2013-02-24 13:01:50 +0900 [2013-02-24 13:01:50.212985 #13829] INFO -- : Processing by ApplicationController#error_404 as HTML [2013-02-24 13:01:50.213102 #13829] INFO -- : Parameters: {"a"=>"hoge"} [2013-02-24 13:01:50.213726 #13829] INFO -- : Rendered text template (0.0ms) [2013-02-24 13:01:50.213928 #13829] INFO -- : Completed 404 Not Found in 1ms (Views: 0.5ms | ActiveRecord: 0.0ms)
params[:a]にurlがセットされます。
controller
あとは例外用actionを書くだけ。
def error_404 render :text => '404 not found', :layout => false, :status => 404 end