# Subdomains question

**URL:** <https://www.ruby-forum.com/t/subdomains-question/157952>\
**Category:** Rails\
**Created:** [January 16, 2009, 9:16pm UTC](https://www.ruby-forum.com/t/subdomains-question/157952 "2009-01-16T21:16:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![elioncho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed8c4c/32.png) [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Post date:** [January 16, 2009, 9:16pm UTC](https://www.ruby-forum.com/t/subdomains-question/157952/1 "2009-01-16T21:16:43Z")

</div>

Hello,

I have followed

[http://www.robbyonrails.com/articles/2009/01/11/subdomain-accounts-with-ruby-on-rails-explained](http://www.robbyonrails.com/articles/2009/01/11/subdomain-accounts-with-ruby-on-rails-explained)  
and

> **[How to do Basecamp-style subdomains in Rails](https://signalvnoise.com/posts/1512-how-to-do-basecamp-style-subdomains-in-rails)**
>
> \# 1) Point \*.example.com in your DNS setup to your server.
> \#
> \# 2) Setup an Apache vhost to catch the star pointer:
> \#
> \# 
> \# ServerName example.com
> \# ServerAlias \*.example.com
> \# 
> \#
> \# 3) Set the current account from the subdomain
> class...

posts on working with subdomains (without the use of subomain-fu and  
other plugins). In those examples a user only can log into his/her  
account through his/her own subdomain.

I wonder is there a way to log into one’s account (subdomain) from the  
domain.

Example:

Logging from [www.foo.com/session/new](http://www.foo.com/session/new),

should redirect me to,

[elioncho.foo.com](http://elioncho.foo.com)

Any ideas? Thanks,

---

<div class="post-metadata">

**Author:** ![elioncho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed8c4c/32.png) [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Post date:** [January 18, 2009, 8:43pm UTC](https://www.ruby-forum.com/t/subdomains-question/157952/2 "2009-01-18T20:43:06Z")

</div>

On Fri, Jan 16, 2009 at 12:16 PM, elioncho [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> account through his/her own subdomain.  
> [elioncho.foo.com](http://elioncho.foo.com)

Hi there,

You could just authenticate off of the Person/User model (whatever you  
name that) without scoping it to the account. Then just redirect\_to  
account\_path(@user.account) or something along those lines.

Good luck!

Cheers,  
Robby

–  
Robby R.  
Chief Evangelist, Partner

PLANET ARGON, LLC  
design // development // hosting w/Ruby on Rails

> **[Planet Argon](https://www.planetargon.com/)**
>
> Planet Argon is a Ruby on Rails development agency specializing in maintenance and support for existing Rails apps. Based in Portland, OR, Planet Argon has been a member of the Rails community since 2004.

[http://www.robbyonrails.com/](http://www.robbyonrails.com/)  
aim: planetargon

+1 503 445 2457  
+1 877 55 ARGON [toll free]  
+1 815 642 4068 [fax]
