• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

One application, multiple domains/subdomains

Guest
Jul 18, 2007 Jul 18, 2007

Copy link to clipboard

Copied

Hi,

I have an application, let's say its running at
boston.mydomain.com
Currently, it serves content for the city of Boston only.
Let's say I want to expand my application to serve Los Angeles, so I set up losangeles.mydomain.com
I need to serve different content for Los Angeles. For example, when someone registers, I need to give them a drop-down list of Los Angeles neighborhoods.

I have a very simple database structure right now, but will expand it with a neighborhoods table that is tied to city with a foreign key.

What I'm wondering is, what kind of variables would I set in the application.cfm file or elsewhere to ensure that a given user gets content specific to them based on the subdomain they have accessed? Would I set a cookie, like cityID=4 that is read in with each page hit and continually serves up the correct content? What if a user has cookies turned off? Is there are better way to do this?

FYI, I am a little rusty at CF, and my knowledge extends mainly through version 6.

Thanks all.

-Ben
TOPICS
Advanced techniques

Views

244

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 18, 2007 Jul 18, 2007

Copy link to clipboard

Copied

You could use the cookie scope. I think many would use the session
scope for this kind of data as well, but that ultimately still relies on
cookies and|or URL parameters to identify the which user goes with which
session.

For your simple example, the cgi structure could be of use. It would
allow you to determine what domain brought the user to the application.
This information could then be used to branch the application logic.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 20, 2007 Jul 20, 2007

Copy link to clipboard

Copied

LATEST
Thanks. That helps clarify things.

So your pseudocode would be like this:

if subdomain = austin
then set session.region=1
elseif subdomain = boston
then set session.region=2

Would I set this on every page? Or just once?

I assume this is independent of whether the user is logged on or not.

Thx,

Ben

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation