Question for rails multidomain application design

Hi to all,

I would design an application for multidomain support and my question is what is the best practice to do this kind of application ?


I think to write my application handling the multidomain into routing map:

map.connect ":domain/:controller/:action" map.connect ":domain/:controller/:action/:id"

Assuming that I hanlde 3 domains for 3 different customers:

My customers requests could be:

routed to RoR application:

/ / /

RoR application controller could read the home data from model finding by domain param (es. @home = Home.find_by_domain(params[:domain])

I would like to know if it is possible (and how can I solve) this kind of routing (maybe using Apache internal rewrite ?).

Thanks in advance ! ...