Topic: Preparing for multiple subdomains

Hi,

I am building an app that will function somewhat like Craiglist.

The name of a region will be a subdomain, and will determine which region content is shown to the user.  Fortunately, I do not need to do IP lookup--the user has to choose their region themselves.

Here is my application's logic:

1) The user goes to domain.com

The home page says:

Welcome.  Please choose your region:

[  ] Minneapolis/St. Paul Metro Area
[  ] Dallas Metro Area
[  ] Greater Chicago, IL

2) This takes then to RegionName.domain.com, and sets a cookie or session variable with the id of the region.  My regions model has just id and region.  All future content will be keyed to the region the user has chosen, unless they go back and select a different one.

I am developing on Ubuntu 7.x and Rails 1.2.3, but will be moving to Instant Rails on Windows next year.

The first question:

Since I'm using localhost:3000/myAppName to serve my web site for now, how do I simulate and prepare for the use of subdomains as I've outlined above?  Can I set routing so that:

localhost:3000/myAppName/regionName
is the same as
regionName.domain.com?

If so, how would I do this?

Are there other considerations here?

Thanks,

Ben

Design, XHTML, CSS, CMS, Expression Engine, Open-source, ColdFusion.  Learning Rails.

Re: Preparing for multiple subdomains

There is a plugin for this ... a recent post had some details, can't remember of the top of my head.

Toby Hede
===================================================
FiniteStateMachine - Software Development for Social Networks
===================================================

Re: Preparing for multiple subdomains

Thanks, a search turned up what I needed.

Riding Rails: Dan Webb's Request Routing Plugin
http://weblog.rubyonrails.org/2006/5/22 … ing-plugin

Last edited by 4midori (2007-10-30 18:47:26)

Design, XHTML, CSS, CMS, Expression Engine, Open-source, ColdFusion.  Learning Rails.