In one of my apps i route differently depending on which host/domain we're on ("cmw" or the normal site). This is how i set it up:
#in config/routes.rb
cmw = { :host => CMW_HOST_REGEX } #CMW_HOST_REGEX set in a constants file
#cmw routes
map.cmw_home '/', :controller => "cmw/home", :conditions => cmw
map.connect '', :controller => "cmw/home", :conditions => cmw
map.resources :students, :conditions => cmw
#regular section - don't have the condition
map.home '/', :controller => "home"
map.connect '', :controller => "home"
map.resources :teachers
#etc
The key thing here is that you can pass a value :host => <regex>
to the :conditions option on each route, which will apply that regex to the current hostname.
EDIT - this is rails 2 (and maybe 3) syntax btw, but you should get the idea and be able to adapt it to whatever version of rails you're using.
EDIT 2 - note that because the cmw routes are more specific, with the extra condition, they all need to be listed BEFORE the "normal" routes, since routes are matched in order from top to bottom of the file.