I've got a before hook in my Sinatra app: before do if request.env['HTTP_HOST'] == "APP_NAME.heroku.com" || request.env['HTTP_HOST'] == "APP_NAME.com" redirect "http://www.APP_NAME.com#{request.fullpath}", 301 end end
My rails knowledge is zero, but I'm guessing* you can write a before_filter method in the ApplicationController to do something smiliar? Not sure if my method is the best way either. *I'm literally making this up. On 2 June 2011 04:12, Aaron Brethorst <aa...@brethorsting.com> wrote: > I remember a couple weeks back we were strongly advised to send all traffic > to "www." instead of a bare domain. What is the best way to ensure this > happens? I would do this at the Rack middleware level, but I'm getting > frequent reports of 'server not responding' errors from users when they try > accessing the site, which means the Rack option is right out. > > Thanks, > Aaron > > -- > You received this message because you are subscribed to the Google Groups > "Heroku" group. > To post to this group, send email to heroku@googlegroups.com. > To unsubscribe from this group, send email to > heroku+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/heroku?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Heroku" group. To post to this group, send email to heroku@googlegroups.com. To unsubscribe from this group, send email to heroku+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/heroku?hl=en.