views:

31

answers:

1

Hi folks, 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 way to handle this in rails?

+3  A: 

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.

Richard Cook
thanks! Good solution. ;)
ming yeow