ruby on rails - How do I redirect domains on heroku? -
i have app designed multiple users on stuff.heroku.com
a landing page might stuff.heroku.com/controller/1/action/73
but url want redirect there looks sub.domain.com/hello
similarly, may want sub.domain.com/greetings point landing page, time @ stuff.heroku.com/controller/1/action/74.
once works, want sub.anotherdomain.com/hello map same application, such stuff.heroku.com/controller/1/action/87
how can that?
you can in application_controller , redirect there.
in rails 2.3+ can use rack middleware. check out refraction gem -- it's setup rack replacement mod_rewrite
https://github.com/pivotal/refraction
refraction.configure |request| if req.host == 'sub.domain.com' req.rewrite! "http://sub.domain.com/#{req.path}" end end
the above take people stuff.heroku.com sub.domain.com -- /hello rewrite if want.
Comments
Post a Comment