# Domain (not subdomain) routing

**URL:** <https://www.ruby-forum.com/t/domain-not-subdomain-routing/82628>\
**Category:** Rails\
**Created:** [January 19, 2007, 4:31pm UTC](https://www.ruby-forum.com/t/domain-not-subdomain-routing/82628 "2007-01-19T16:31:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [January 19, 2007, 4:31pm UTC](https://www.ruby-forum.com/t/domain-not-subdomain-routing/82628/1 "2007-01-19T16:31:49Z")

</div>

I have several websites that are all basically the same thing but with  
a different layout and a different primary controller

- [http://www.website1.com](http://www.website1.com) - has views/layouts/website1 and  
controllers/website1
- [http://www.website2.com](http://www.website2.com) - has views/layouts/website2 and  
controllers/website2

Everything else is the same, DB, graphics, other views, etc…

So I though …

- have 1 rails app
- have a virtual host in apache for each virtual app
- route requests for each domain to the same mongrel
- have rails route based on DOMAIN

Any idea how to do this. I’ll check out the source to the  
request\_routing plugin.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 25, 2007, 10:48pm UTC](https://www.ruby-forum.com/t/domain-not-subdomain-routing/82628/2 "2007-09-25T22:48:31Z")

</div>

Yes, you want the request routing plugin and the theme\_support plugin.

–  
Building an e-commerce site with Rails?  
[http://www.agilewebdevelopment.com/rails-ecommerce](http://www.agilewebdevelopment.com/rails-ecommerce)
