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 ?

Eg.:

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:

www.first.com
www.second.com

My customers requests could be:

http://www.first.com/public/home
http://www.second.com/public/home

routed to RoR application:

/www.first.com/public/home
/www.second.com/public/home
/www.third.com/public/home

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 !