2 Replies Latest reply on Jul 20, 2007 8:41 PM by 4midori4

    One application, multiple domains/subdomains


      I have an application, let's say its running at
      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.

        • 1. Re: One application, multiple domains/subdomains
          Level 7
          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

          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.

          • 2. Re: One application, multiple domains/subdomains
            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.