Topic: Preparing for multiple subdomains
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:
is the same as
If so, how would I do this?
Are there other considerations here?