KILIÇ.NET

Rails without 404s

For a Rails project that I'm working on I had a need to catch all requests to the site. Rather than serve up a typical 404 "Page not found" message, I want to redirect all requests to the sites home page.

In Rails, it turns out to be only a one-liner in your Routes.rb file:

map.connect ':id', :controller => 'blog'

You just need to make sure this is the very last map and you're all set to go!.

Technorati Tags: , ,