views:

72

answers:

1

A lot of my users keep going to http://(rails app URL)/blog, but I don't actually have a blog. I finally setup a Posterous blog and now want to direct my users there. Is there a way to configure this using routes.rb? Is there a better way that doesn't involve editing the httpd.conf file?

+3  A: 

Depends on the Rails version you are using.

Rails 3
match "/blog" => redirect("http://example.com/blog"), :as => :blog

or

Rails 2

# in routes.rb
map.blog '/blog', :controller => "a_helper_controller", :action => "redirect_to_blog"

# in a_helper_controller.rb
def redirect_to_blog
  redirect_to "http://example.com/blog"
end
Marcel J.