# Accounts and subdomains

**URL:** <https://www.ruby-forum.com/t/accounts-and-subdomains/70564>\
**Category:** Rails\
**Created:** [February 19, 2006, 7:57pm UTC](https://www.ruby-forum.com/t/accounts-and-subdomains/70564 "2006-02-19T19:57:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aftershock](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8e7dd6/32.png) [@aftershock](https://www.ruby-forum.com/u/aftershock)\
**Post date:** [February 19, 2006, 7:57pm UTC](https://www.ruby-forum.com/t/accounts-and-subdomains/70564/1 "2006-02-19T19:57:23Z")

</div>

With reference to a previous  
post:[Sortable list (scriptalicious) and updating database - Rails - Ruby-Forum](http://www.ruby-forum.com/topic/55201#new)

I would like my app to function as follows:

A new user signs up for my application, his username is “andy”. When  
andy now logs in to the application the url is redirected to :  
[http://andy.myapplication.com](http://andy.myapplication.com)

Questions:

Is this possible to develop on a windows box with webrick?  
Do I need anything special like lighttpd to achieve this?  
Can this be done automatically without manually editing a http config  
file?

Alternative:

As an alternative I could have the url look like:  
[http://www.myapplication.com/andy](http://www.myapplication.com/andy)  
so that an operation could be then located at:  
[http://www.myapplication.com/andy/articles/list](http://www.myapplication.com/andy/articles/list)

Questions:  
Is this better to use for developing on a standalone system?  
Could I then use routes to achieve this?  
Is this recommended over the first option?

I need to get this resolved before I commence building as it will affect  
all the controllers etc.

Thanks 😉

---

<div class="post-metadata">

**Author:** ![aftershock](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8e7dd6/32.png) [@aftershock](https://www.ruby-forum.com/u/aftershock)\
**Post date:** [February 19, 2006, 10:20pm UTC](https://www.ruby-forum.com/t/accounts-and-subdomains/70564/2 "2006-02-19T22:20:21Z")

</div>

James W. wrote:

> A new user signs up for my application, his username is “andy”. When  
> andy now logs in to the application the url is redirected to :  
> [http://andy.myapplication.com](http://andy.myapplication.com)
> 
> Questions:
> 
> Is this possible to develop on a windows box with webrick?  
> Do I need anything special like lighttpd to achieve this?  
> Can this be done automatically without manually editing a http config  
> file?

You’ll need is to edit your host file[1], inserting values for  
[localhost.com](http://localhost.com) and [andy.localhost.com](http://andy.localhost.com). Sure the real [localhost.com](http://localhost.com) will  
be  
unreachable after this, but in return you’ll have nice subdomained  
system  
localhosted as it suits you better.

[1] [hosts (file) - Wikipedia](http://en.wikipedia.org/wiki/Hosts_file)

---

<div class="post-metadata">

**Author:** ![aftershock](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8e7dd6/32.png) [@aftershock](https://www.ruby-forum.com/u/aftershock)\
**Post date:** [February 19, 2006, 10:46pm UTC](https://www.ruby-forum.com/t/accounts-and-subdomains/70564/3 "2006-02-19T22:46:20Z")

</div>

Dee Z. wrote:

> James W. wrote:
> 
> > A new user signs up for my application, his username is “andy”. When  
> > andy now logs in to the application the url is redirected to :  
> > [http://andy.myapplication.com](http://andy.myapplication.com)
> > 
> > Questions:
> > 
> > Is this possible to develop on a windows box with webrick?  
> > Do I need anything special like lighttpd to achieve this?  
> > Can this be done automatically without manually editing a http config  
> > file?
> 
> You’ll need is to edit your host file[1], inserting values for  
> [localhost.com](http://localhost.com) and [andy.localhost.com](http://andy.localhost.com). Sure the real [localhost.com](http://localhost.com) will  
> be  
> unreachable after this, but in return you’ll have nice subdomained  
> system  
> localhosted as it suits you better.
> 
> [1] [hosts (file) - Wikipedia](http://en.wikipedia.org/wiki/Hosts_file)

Yes your right but I would like to automate the whole process just like  
backpack etc does. When a user signs up for an account a new subdomain  
is created so that when he logs in he sees something like:  
[http://www.myapplication.com/andy](http://www.myapplication.com/andy)

---

<div class="post-metadata">

**Author:** ![aftershock](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8e7dd6/32.png) [@aftershock](https://www.ruby-forum.com/u/aftershock)\
**Post date:** [February 19, 2006, 11:05pm UTC](https://www.ruby-forum.com/t/accounts-and-subdomains/70564/4 "2006-02-19T23:05:40Z")

</div>

you’d only have to do the host file on your local system; online with  
a real DNS server behind it, it should be automatic.

you could always install a DNS server at home. 🙂

On 2/19/06, James W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > Can this be done automatically without manually editing a http config
> 
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–  
=\> the blog from beyond \<=  
=\> [www.eyeheartzombies.com](http://www.eyeheartzombies.com) \<=
