Using Morph Labs' Appspace to deploy a site means no automated way to redirect 'myapp.com' to 'www.myapp.com' (and no access to .htacess).
Is there an in-rails way to do this? Would I need a plugin like subdomain-fu?
More specifically, I'm trying to do something like:
Basically, I always want the 'www' subdomain prepended on every request (because the SSL cert specifically has a common name of 'www.myapp.com').
Maybe something like this would do the trick:
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) end end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With