# Subdomain creation and management

**URL:** <https://www.ruby-forum.com/t/subdomain-creation-and-management/183569>\
**Category:** Rails\
**Created:** [February 16, 2010, 6:40pm UTC](https://www.ruby-forum.com/t/subdomain-creation-and-management/183569 "2010-02-16T18:40:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CiriusMex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/90ced4/32.png) [@CiriusMex](https://www.ruby-forum.com/u/CiriusMex)\
**Post date:** [February 16, 2010, 6:40pm UTC](https://www.ruby-forum.com/t/subdomain-creation-and-management/183569/1 "2010-02-16T18:40:20Z")

</div>

Hello,

I’m creating a webapplication where I would like to dinamically create  
and detect subdomains. Let’s say my webapplication url is [www.wookie.com](http://www.wookie.com)  
Here comes an exemple:

1. Someone subscribe to the application with the name john
2. I create a new folder in my public/users folder named john. This  
folder will contain all the accounts images, files …etc…
3. The user can connect to his personal page using the url:  
[john.wookie.com](http://john.wookie.com)

I don’t have any idea how to do this with RubyOnRails. Is it possible  
to automatically create and manage subdomains without having to create  
them manualy on the host server?

Thansk for your help.

---

<div class="post-metadata">

**Author:** ![CiriusMex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/90ced4/32.png) [@CiriusMex](https://www.ruby-forum.com/u/CiriusMex)\
**Post date:** [February 17, 2010, 12:42am UTC](https://www.ruby-forum.com/t/subdomain-creation-and-management/183569/2 "2010-02-17T00:42:38Z")

</div>

On 16 Feb 2010, at 18:38, CiriusMex wrote:

> I don’t have any idea how to do this with RubyOnRails. Is it possible  
> to automatically create and manage subdomains without having to create  
> them manualy on the host server?

It’s called a wildcard domain and you can easily do it with RoR if you  
set up your DNS and Apache right. There are plugins around for  
extracting the subdomain, if it isn’t part of the latest Rails version  
already. You then use that in your authentication to determine the  
account. With Paperclip or attachment\_fu, you can handle the uploads  
and store them in the structure you have in mind.

Best regards

Peter De Berdt
