Here is what I use to host multiple sites on the same IP:

<cfsetting enablecfoutputonly="yes">

<cfset strRedirect = "">
<cfset strURL = #cgi.server_name#>

<cfswitch expression="#strURL#">
  <cfcase value="www.strandedmusic.com">
    <cfset strRedirect = "NULL">
        <cfset strInclude = "/includes/stranded/index.cfm">
  </cfcase>
  <cfcase value="strandedmusic.com">
    <cfset strRedirect = "NULL">
        <cfset strInclude = "/includes/stranded/index.cfm">
  </cfcase>
  <cfcase value="www.scottvanvliet.com">
    <cfset strRedirect = "/calendar/">
  </cfcase>
  <cfcase value="scottvanvliet.com">
    <cfset strRedirect = "/calendar/">
  </cfcase>
  <cfcase value="www.inertia.ws">
    <cfset strRedirect = "/anthony/">
  </cfcase>
  <cfcase value="inertia.ws">
    <cfset strRedirect = "/anthony/">
  </cfcase>
  <cfcase value="www.boardworksinteractive.com">
    <cfset strRedirect = "http://www.bwinteractive.com";>
  </cfcase>
  <cfcase value="boardworksinteractive.com">
    <cfset strRedirect = "http://www.bwinteractive.com";>
  </cfcase>
  <cfcase value="www.bwim.net">
    <cfset strRedirect = "http://www.bwinteractive.com";>
  </cfcase>
  <cfcase value="bwim.net">
    <cfset strRedirect = "http://www.bwinteractive.com";>
  </cfcase>
  <cfcase value="www.theinteractiveco.com">
    <cfset strRedirect = "/interactive/web/">
  </cfcase>
  <cfcase value="theinteractiveco.com">
    <cfset strRedirect = "/interactive/web/">
  </cfcase>
  <cfcase value="admin.controlyourwebsite.com">
    <cfset strRedirect = "/login.cfm">
  </cfcase>
  <cfcase value="beta.controlyourwebsite.com">
    <cfset strRedirect = "/login.cfm">
  </cfcase>
  <cfcase value="propaganda.controlyourwebsite.com">
    <cfset strRedirect = "/login.cfm">
  </cfcase>
  <cfdefaultcase>
    <cfset strRedirect="/cyws/">
  </cfdefaultcase>
</cfswitch>

<cfif strRedirect EQ "NULL">
  <cfsetting enablecfoutputonly="no">
  <cfinclude template="#strInclude#">
<cfelse>
  <cflocation url="#strRedirect#">
</cfif>

<cfsetting enablecfoutputonly="no">

You can go further and trim of the "www." and reduce
the number of <cfcase>'s, however I wanted to have
cononical domain names hosted here to (ie. beta.mysite.com)

Scott


-----Original Message-----
From: McCollough, Alan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 15, 2001 10:29 AM
To: Fusebox
Subject: RE: relative directory paths


Yes, but indeed, the availability of cgi.http_host points to something I've
been meaning to get to myself:

On the side, I've got my own little op, called www.kittycatonline.com . Now,
of course like most folks, I've got more than one domain name registered
(ain't everybody?). Its like owning 2 TV sets or 2 cars...

Anyhow, I'm thinking in this sort of environment, if you do a CFSWITCH based
on CGI.HTTP_HOST, you can then steer viewers to the correct content based on
what they came in for.

The idea here is, I'm going through a provider (abihosting, as somebody here
recommended last month), and want to host multiple sites. however, I don't
want to -pay- for multiple sites, just for multiple domain registrations.

Mind you, I've been too lazy to actually implement this http_host switch on
my site; I'm a bum! Hah!

But I think it should work, right?

> -----Original Message-----
> From: Bert Dawson [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, May 15, 2001 8:36 AM
> To:   Fusebox
> Subject:      RE: relative directory paths
>
> the cgi.http_host can be different for the same machine....
> eg http://209.165.154.6/ and http://www.anmc.org/
>
> Bert
>
> ps i enhanced the one below to check for a URL parameter, which if
> defined,
> would cause the file to revert back to the original, but i can't find it
> now
> - i think it overwrote itself...
>
> > -----Original Message-----
> > From: McCollough, Alan [mailto:[EMAIL PROTECTED]]
> > Sent: 15 May 2001 17:10
> > To: Fusebox
> > Subject: RE: relative directory paths
> >
> >
> > This is cool!
> > I love how the code rewrote itself.
> > BuTtTtTt, how does this differ from simply quering the value of
> > CGI.HTTP_HOST ?
> >
> > > -----Original Message-----
> > > From:     Kevin Bridges [SMTP:[EMAIL PROTECTED]]
> > > Sent:     Tuesday, May 15, 2001 6:50 AM
> > > To:       Fusebox
> > > Subject:  RE: relative directory paths
> > >
> > > Pretty slick.  So if a group were working with some type of
> > source control
> > > this would be the file checked into source control ... each
> > time a new
> > > installation is done on either a developers machine, test server, or
> > > production server they get latest and this code runs the
> > first time the
> > > application is hit turning the cfset request.thisserver
> > into a hardcoded
> > > variable specific to that machine.  That's cool.
> > >
> > > -----Original Message-----
> > > From: Bert Dawson [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, May 15, 2001 8:36 AM
> > > To: Fusebox
> > > Subject: RE: relative directory paths
> > >
> > >
> > > I wrote something similar, but didn't like the idea of reading the
> > > registry
> > > with everypage request, so i came up with a dynamic
> > whatserveristhis.cfm:
> > >
> > > <cfset
> > >
> > regroot="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\C
> > omputerName\
> > > Co
> > > mputerName">
> > >
> > > <cfregistry action="GETALL"
> > >             branch="#regroot#"
> > >             name="RegQuery"
> > >                   type="String">
> > >
> > > <cfset request.thisserver = RegQuery.value>
> > >
> > > <cffile action="READ" file="#GetCurrentTemplatePath()#"
> > variable="myvar">
> > >
> > > <cfset output = "<cfsilent>"
> > >                     & chr(60) & "!--- "
> > >                     & chr(10)
> > >                     & myvar
> > >                     & chr(10)
> > >                     & " ---" & chr(62)
> > >                     & chr(10)
> > >                     & "</cfsilent><cfset request.thisserver = """
> > >                     & request.thisserver & """>">
> > >
> > > <cffile action="Write"
> > >     file="#GetCurrentTemplatePath()#"
> > >     output="#output#"
> > >   addnewline="No">
> > >
> > >
> > > What is does is read the registry and set the
> > request.thisserver = machine
> > > name.
> > > And now the cunning bit - it uses CFFILE read and write to
> > replace itself
> > > with the <cfset> hardcoded, and the rest commented
> > out...try it and you'll
> > > see what i mean.
> > >
> > > Bert
> > >
> > >
> > > > -----Original Message-----
> > > > From: Kevin Bridges [mailto:[EMAIL PROTECTED]]
> > > > Sent: 15 May 2001 15:08
> > > > To: Fusebox
> > > > Subject: RE: relative directory paths
> > > >
> > > >
> > > > It's a user defined variable ... I use the following in app_model:
> > > >
> > > > <cfregistry action="Get"
> > > >
> > > > branch="HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Comput
> > > > erName\ActiveC
> > > > omputerName"
> > > >     entry="ComputerName" type="String"
> > > > variable="request.site.profile">
> > > > <cfif not IsDefined("request.site.profile")>
> > > > <cfregistry action="Get"
> > > >
> > > > branch="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Co
> > > > mputerName\Com
> > > > puterName"
> > > >     entry="ComputerName" type="String"
> > > > variable="request.site.profile">
> > > > </cfif>
> > > >         <cfset
> > > > request.site.profile=Replace(request.site.profile," ","")>
> > > > <cfinclude template="app_model-#request.site.profile#.cfm">
> > > >
> > > > Which then pulls a specific app_model-MACHINENAME.cfm (2
> > > > registry tags one
> > > > for w98 one for w2000)that is specific for the machine it is
> > > > running on so
> > > > that I'm not constantly changing variables when I switch
> > > > machines ... it
> > > > contains the following:
> > > >
> > > > request.Site.CFRoot="#cgi.PATH_TRANSLATED#";
> > > > request.Site.HostName="#cgi.SERVER_NAME#";
> > > > request.Site.WebRoot="/Web/";
> > > > request.Site.MachineRoot="C:\Web\";
> > > > request.Site.DSN = "MyDSN";
> > > > request.Site.imagesroot="#request.Site.WebRoot#_img/";
> > > > request.Site.title="Site Title";
> > > > request.Site.dbtype="Oracle80";
> > > > request.Site.ApplicationTimeout="20";
> > > > request.Site.MailServer="mail.server";
> > > >
> > > > Then for each module I use an app_locals that contains:
> > > >
> > > > // Site Specific Variables
> > > > request.Module.CFRoot="#cgi.PATH_TRANSLATED#";
> > > > request.Module.WebRoot="#request.site.WebRoot#ModuleName/";
> > > >
> > request.Module.MachineRoot="#request.Site.MachineRoot#ModuleName\";
> > > > request.Module.DSN = "#request.site.dsn#";
> > > > request.Module.dbtype="#request.site.dbtype#";
> > > > request.Module.imagesroot="#request.site.imagesroot#";
> > > > request.Module.title="My Module";
> > > >
> > request.Site.ApplicationTimeout="#request.Site.ApplicationTimeout#";
> > > > request.Site.MailServer="#request.Site.MailServer#";
> > > >
> > > > That way I can break the modules off and use them as
> > > > standalone applications
> > > > or plug them into a larger system at will.  I can also
> > change specific
> > > > varaibles for the modules if I ever need to.
> > > >
> > > > -----Original Message-----
> > > > From: McCollough, Alan [mailto:[EMAIL PROTECTED]]
> > > > Sent: Monday, May 07, 2001 9:52 AM
> > > > To: Fusebox
> > > > Subject: RE: relative directory paths
> > > >
> > > >
> > > > I gotta ask, cuz' I don't know and its early Monday...
> > > > This request.cfroot, is it an internal variable used by
> > CF, or is it a
> > > > user-defined variable that y'all are using to tack down the
> > > > root dir for a
> > > > give app?
> > > >
> > > > > -----Original Message-----
> > > > > From: Tim Price [SMTP:[EMAIL PROTECTED]]
> > > > > Sent: Friday, May 04, 2001 6:55 AM
> > > > > To:   Fusebox
> > > > > Subject:      RE: relative directory paths
> > > > >
> > > > > Tim (great name by the way !)
> > > > >
> > > > > I already have my request.cfroot variable set to <cfset
> > > > request.cfroot =
> > > > > "/somedir">
> > > > >
> > > > > thanx anyway
> > > > >
> > > > > Tim
> > > > > {redacted}
> > > >
> > >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to