# Ho to capture the domain name

**URL:** <https://www.ruby-forum.com/t/ho-to-capture-the-domain-name/92845>\
**Category:** Rails\
**Created:** [April 24, 2007, 11:26pm UTC](https://www.ruby-forum.com/t/ho-to-capture-the-domain-name/92845 "2007-04-24T23:26:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsn1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jsn1](https://www.ruby-forum.com/u/jsn1)\
**Post date:** [April 24, 2007, 11:26pm UTC](https://www.ruby-forum.com/t/ho-to-capture-the-domain-name/92845/1 "2007-04-24T23:26:58Z")

</div>

Hi all

Is there a way to capture the domain name and form there open one  
application or another.

I have to domains registered. domain1 and domain2

Is there a way when someone types [www.domain1.com](http://www.domain1.com) it calls a RoR page  
that allows me to redirect the person to a specific application or to a  
specific domain?

thanks

---

<div class="post-metadata">

**Author:** ![jsn1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jsn1](https://www.ruby-forum.com/u/jsn1)\
**Post date:** [April 25, 2007, 4:31am UTC](https://www.ruby-forum.com/t/ho-to-capture-the-domain-name/92845/2 "2007-04-25T04:31:29Z")

</div>

On Apr 24, 2007, at 5:26 PM, Jose P. wrote:

> I have to domains registered. domain1 and domain2
> 
> Is there a way when someone types [www.domain1.com](http://www.domain1.com) it calls a RoR page  
> that allows me to redirect the person to a specific application or  
> to a  
> specific domain?

yes. look at the request object.

-faisal

---

<div class="post-metadata">

**Author:** ![jsn1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jsn1](https://www.ruby-forum.com/u/jsn1)\
**Post date:** [August 29, 2007, 1:37am UTC](https://www.ruby-forum.com/t/ho-to-capture-the-domain-name/92845/3 "2007-08-29T01:37:05Z")

</div>

the domain function  
[http://api.rubyonrails.org/classes/ActionController/AbstractRequest.html#M000236](http://api.rubyonrails.org/classes/ActionController/AbstractRequest.html#M000236)
