开发者

2 domains using the same host, but routed differently

开发者 https://www.devze.com 2023-01-17 02:57 出处:网络
i have 2 domains (a.com and b.com) using the same application. However, I would need them to point to different routes.

i have 2 domains (a.com and b.com) using the same application. However, I would need them to point to different routes.

a.com should use the action: /home/a_index

b.com should use the action: /home/b_index

What is the right wa开发者_如何学编程y to handle this in rails?


This and this are both very useful articles describing one approach to running multiple domains from a single Rails application. Essentially the approach outlined in both articles allows you to route to different controllers for different domains using routing statements like the following:

map.connect '', :controller => 'blah', :action => 'blah', :conditions => {:domain => 'blah'}

This should allow you to achieve your goal.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号