# Variable in url

**URL:** <https://www.ruby-forum.com/t/variable-in-url/107119>\
**Category:** Rails\
**Created:** [June 18, 2007, 12:09pm UTC](https://www.ruby-forum.com/t/variable-in-url/107119 "2007-06-18T12:09:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tarscher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@Tarscher](https://www.ruby-forum.com/u/Tarscher)\
**Post date:** [June 18, 2007, 12:09pm UTC](https://www.ruby-forum.com/t/variable-in-url/107119/1 "2007-06-18T12:09:36Z")

</div>

Hi all,

I want to build a url like this: [name.site.com](http://name.site.com) . Can RoR read out the  
name in the url? If not I supose it’s uo to the webserver. Can webrick  
or Mongrel use this and pass this to RoR. I need the name in the url  
since it will define what will be shown on the page.

Thanks  
Stijn

---

<div class="post-metadata">

**Author:** ![Tarscher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@Tarscher](https://www.ruby-forum.com/u/Tarscher)\
**Post date:** [June 18, 2007, 1:37pm UTC](https://www.ruby-forum.com/t/variable-in-url/107119/2 "2007-06-18T13:37:51Z")

</div>

I dont know exactly how it would be done, but i am sure that it can be  
done. Take the [USERNAME.highrisehq.com](http://USERNAME.highrisehq.com) thing 37signals got going.

---

<div class="post-metadata">

**Author:** ![Tarscher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@Tarscher](https://www.ruby-forum.com/u/Tarscher)\
**Post date:** [June 18, 2007, 1:44pm UTC](https://www.ruby-forum.com/t/variable-in-url/107119/3 "2007-06-18T13:44:52Z")

</div>

37signals use this in all their products but i want to know how they  
do it.

Someone has an idea?

Thanks,  
Stijn

---

<div class="post-metadata">

**Author:** ![Tarscher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@Tarscher](https://www.ruby-forum.com/u/Tarscher)\
**Post date:** [June 18, 2007, 6:22pm UTC](https://www.ruby-forum.com/t/variable-in-url/107119/4 "2007-06-18T18:22:35Z")

</div>

Thanks alot!

On Jun 18, 2:31 pm, Xin Z. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Tarscher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@Tarscher](https://www.ruby-forum.com/u/Tarscher)\
**Post date:** [June 18, 2007, 2:31pm UTC](https://www.ruby-forum.com/t/variable-in-url/107119/5 "2007-06-18T14:31:26Z")

</div>

\_why’s done it again.

[http://redhanded.hobix.com/bits/dynamicVhostsOneLinerForRails.html](http://redhanded.hobix.com/bits/dynamicVhostsOneLinerForRails.html)

---

<div class="post-metadata">

**Author:** ![Tarscher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@Tarscher](https://www.ruby-forum.com/u/Tarscher)\
**Post date:** [June 18, 2007, 6:35pm UTC](https://www.ruby-forum.com/t/variable-in-url/107119/6 "2007-06-18T18:35:37Z")

</div>

Xin Z. wrote:

> \_why’s done it again.
> 
> [http://redhanded.hobix.com/bits/dynamicVhostsOneLinerForRails.html](http://redhanded.hobix.com/bits/dynamicVhostsOneLinerForRails.html)

How you integrate it with url\_for? So :controller =\> ‘account’,  
:action =\> ‘home\_page’, :id =\> user.login goes in, and a virtual host  
URL comes out?

–  
Phlip  
[http://c2.com/cgi/wiki?ZeekLand](http://c2.com/cgi/wiki?ZeekLand) ← NOT a blog!!
