Subdomain creation and management


I'm creating a webapplication where I would like to dinamically create
and detect subdomains. Let's say my webapplication url is
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:

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.

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