# Question for rails multidomain application design

**URL:** <https://www.ruby-forum.com/t/question-for-rails-multidomain-application-design/118857>\
**Category:** Rails\
**Created:** [October 31, 2007, 6:18pm UTC](https://www.ruby-forum.com/t/question-for-rails-multidomain-application-design/118857 "2007-10-31T18:18:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gianluca\_t](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/d78d45/32.png) [@gianluca\_t](https://www.ruby-forum.com/u/gianluca_t)\
**Post date:** [October 31, 2007, 6:18pm UTC](https://www.ruby-forum.com/t/question-for-rails-multidomain-application-design/118857/1 "2007-10-31T18:18:34Z")

</div>

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](http://www.first.com)  
[www.second.com](http://www.second.com)

> **[GapGun and Vectro Non-Contact Laser Measurement](https://www.third.com/)**
>
> Measure gap and flush using GapGun and Vectro (hand-held and automated) non-contact precision feature measurement tools by Third Dimension.

My customers requests could be:

[http://www.first.com/public/home](http://www.first.com/public/home)  
[http://www.second.com/public/home](http://www.second.com/public/home)

> **[GapGun and Vectro Non-Contact Laser Measurement](https://www.third.com/)**
>
> Measure gap and flush using GapGun and Vectro (hand-held and automated) non-contact precision feature measurement tools by Third Dimension.

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 !  
…
