# One app, two subdomains

**URL:** <https://www.ruby-forum.com/t/one-app-two-subdomains/103899>\
**Category:** Deployment\
**Created:** [May 11, 2007, 1:40pm UTC](https://www.ruby-forum.com/t/one-app-two-subdomains/103899 "2007-05-11T13:40:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ingoweiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/77aa72/32.png) [@ingoweiss](https://www.ruby-forum.com/u/ingoweiss)\
**Post date:** [May 11, 2007, 1:40pm UTC](https://www.ruby-forum.com/t/one-app-two-subdomains/103899/1 "2007-05-11T13:40:12Z")

</div>

Hi all,

I would like to point two subdomains to the same app, using the same  
database, with logic in the app showing different content based on the  
subdomain. Right now I am on Dreamhost, and I have no idea how to go  
about this. Is this possible or even a good idea? Thanks for any hint!

Ingo

---

<div class="post-metadata">

**Author:** ![ingoweiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/77aa72/32.png) [@ingoweiss](https://www.ruby-forum.com/u/ingoweiss)\
**Post date:** [May 11, 2007, 2:05pm UTC](https://www.ruby-forum.com/t/one-app-two-subdomains/103899/2 "2007-05-11T14:05:14Z")

</div>

Hi,

Does following help?  
[http://www.jason-palmer.com/ruby-on-rails-tutorials/dynamic-subdomains](http://www.jason-palmer.com/ruby-on-rails-tutorials/dynamic-subdomains)

-Jatinder

---

<div class="post-metadata">

**Author:** ![ingoweiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/77aa72/32.png) [@ingoweiss](https://www.ruby-forum.com/u/ingoweiss)\
**Post date:** [May 11, 2007, 4:26pm UTC](https://www.ruby-forum.com/t/one-app-two-subdomains/103899/3 "2007-05-11T16:26:39Z")

</div>

> Does following help?[http://www.jason-palmer.com/ruby-on-rails-tutorials/dynamic-subdomains](http://www.jason-palmer.com/ruby-on-rails-tutorials/dynamic-subdomains)  
> Thanks, Jatinder! Actually I have the rails side of things (extracting  
> the subdomain and branching off) already implemented. The part that is  
> still missing is how to set it up on the server so that both  
> subdomains point to the same app. Ingo

---

<div class="post-metadata">

**Author:** ![ingoweiss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/77aa72/32.png) [@ingoweiss](https://www.ruby-forum.com/u/ingoweiss)\
**Post date:** [May 11, 2007, 7:49pm UTC](https://www.ruby-forum.com/t/one-app-two-subdomains/103899/4 "2007-05-11T19:49:09Z")

</div>

oh ok.  
If you are running your application behind Apache then you could use  
define vhosts in Apache which routes all your requests at the 2  
subdomains to the same rails application. hope this helps,

> **[Radar - O’Reilly](https://www.oreilly.com/radar/)**
>
> Now, next, and beyond: Tracking need-to-know trends at the intersection of business and technology

-Jatinder
