I'm trying to set the following rule for redirection:
if Rails.env.staging? || Rails.env.production?
r301 %r{.*}, 'http://mysite.com$&', :if => Proc.new {|rack_env|
rack_env['SERVER_NAME'] != 'mysite.com' && rack_env['SERVER_NAME'] != '*.mysite.com'
}
end
I need my subdomains to be included in the condition, however if I dont something like a.mysite.com it will redirect me to mysite.com all the time.
How can I fix it?
Thanks!