# Dynamic subdomain - How to get that

**URL:** <https://www.ruby-forum.com/t/dynamic-subdomain-how-to-get-that/70041>\
**Category:** Rails\
**Created:** [September 26, 2006, 3:24pm UTC](https://www.ruby-forum.com/t/dynamic-subdomain-how-to-get-that/70041 "2006-09-26T15:24:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dorelal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3da27b/32.png) [@dorelal](https://www.ruby-forum.com/u/dorelal)\
**Post date:** [September 26, 2006, 3:24pm UTC](https://www.ruby-forum.com/t/dynamic-subdomain-how-to-get-that/70041/1 "2006-09-26T15:24:51Z")

</div>

These days all over the place I see something like  
[http://john.blinksale.comand](http://john.blinksale.comand)  
[http://mary.blinksale.com](http://mary.blinksale.com)

My question is how to configure the server to have these subdomains  
dynamically. Any pointer to an article/tutorial/book will be helpful.

Thanks.  
-=- Raj

---

<div class="post-metadata">

**Author:** ![dorelal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3da27b/32.png) [@dorelal](https://www.ruby-forum.com/u/dorelal)\
**Post date:** [September 26, 2006, 6:53pm UTC](https://www.ruby-forum.com/t/dynamic-subdomain-how-to-get-that/70041/2 "2006-09-26T18:53:34Z")

</div>

You could also do this with lighty and mod\_mysql\_vhost. or even  
mod\_evhost  
if you don’t mind creating a directory dynamically instead of rows in a  
table.

Vish

---

<div class="post-metadata">

**Author:** ![dorelal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3da27b/32.png) [@dorelal](https://www.ruby-forum.com/u/dorelal)\
**Post date:** [September 26, 2006, 4:43pm UTC](https://www.ruby-forum.com/t/dynamic-subdomain-how-to-get-that/70041/3 "2006-09-26T16:43:14Z")

</div>

Neeraj,

We’ve recently done this with DHH’s account\_location plugin. You can  
get it  
here ([http://dev.rubyonrails.org/svn/rails/plugins/account\_location](http://dev.rubyonrails.org/svn/rails/plugins/account_location)).

Then have your ISP enable wildcard subdomains for your site. This will  
allow \*\*\*.yourdomain.com to be routed to [yourdomain.com](http://yourdomain.com) and then the  
plugin  
will take care of the rest. You’ll still need to do some coding to get  
it  
to work with the way you’ve developed your user accounts.

Sam
