I would recommend something similar to what @Ben Doom suggested; though not storing in session scope. Instead, I would recommend using Application scope. There's no reason to make every user's session repeat the same information over and over.
You can get 2 different "applications" (basically just different address spaces) running from the same codebase by giving them different application names. As Ben suggests, I would base the application name on a CGI variable. Using a hash will guarantee that the value will be safe to use as an application name, but won't be as easy to switch on.
Application.cfc:
component {
this.name = hash(cgi.server_name);
}
Not all CGI variables are safe -- some can be modified by the user (referrer, ip, etc), so if you're going to use one of those, I recommend doing something like hashing it as I've done above to make sure it's safe to use here... But if you use one of the safe values (like cgi.server_name), then you should be safe using it without hashing/etc.
In that case, it would be much easier to setup the theme of the display to switch on which application is running:
Application.cfc:
component {
this.name = cgi.server_name;
}
index.cfm:
<cfimport prefix="custom" taglib="#expandPath('./layouts')#" />
<custom:layout theme="#application.applicationname#">
<!--- your content here --->
</custom:layout>
layouts/layout.cfm:
<cfparam name="attributes.theme" default="www.site1.com" />
<cfif attributes.theme eq "www.site1.com">
<!--- include content for this theme --->
<cfelse>
<!--- include content for this theme --->
</cfif>
(Tested on Win7/IIS7)