This would typically be done by the server (usually Apache). http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html
On Dec 1, 4:44 pm, CuriousNewbie <[email protected]> wrote: > Hello I'm looking to learn how to redirect all non-www (mysite.com) > tohttps://www.mysite.com > > I tried the following: > > class ApplicationController < ActionController::Base > > before_filter :check_uri > > def check_uri > redirect_to request.protocol + "www." + request.host_with_port + > request.request_uri if !/^www/.match(request.host) if Rails.env == > 'production' > end > > Problem with this is since the SSL cert on Heroku is forwww.mysite.com, > and not mysite.com, the browser throws the nasty SSL HTTPS invalid > warning. > > Any ideas on how to redirect in a way that avoids the nasty SSL HTTPs > invalid warning? > > Thanks -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

