Reply to topic
One Domain, Multiple Sites.
mtangorre


Joined: 11 Apr 2004
Posts: 1
Location: Silver Spring, MD
Reply with quote
Lets say I have:

www.site1.com (actual domain with account)
www.site2.com (point to account)
www.site3.com (pointer to account)

www.site1.com is just a show area for clients to see there site mockups, etc... kind of like a show room. So, I have gotten two of my old domains pointed at this site and intend on using one for my blog and the other for some school work.

Anyway, what is the ColdFusion trick to use in the Application.cfm or index.cfm file in order to call up the correct site. Also, what is the easiest way to work with the different sites and directories within each site.
CFLocation
jamie
HostMySite Sales Rep
HostMySite Sales Rep

Joined: 19 Mar 2004
Posts: 766
Location: Newark, De
Reply with quote
I don't know the exact script, however I do know that it's based on using the CFlocation tag to redirect traffic, which is determined by looking at the HTTP Headers that a browser passes to the webserver.

I know that's a really rough overview, but perhaps someone else here could flesh it out for you.
Sample index.cfm
Mike K


Joined: 12 Apr 2004
Posts: 2
Location: NY
Reply with quote
Assume that you want a url for http://www.site1.com (or http://site1.com), which does not specifiy the exact file to use, to go to index.cfm in the folder site1. Similar story for site2.

Put the following code at the top of index.cfm in your root directory:
Code:
<cfset TheDomain=LCase(CGI.HTTP_HOST)>
<cfswitch expression=#TheDomain#>
   <cfcase value="www.site1.com,site1.com">
      <cflocation addtoken="No" url="http://www.site1.com/site1/index.cfm">
   </cfcase>
   <cfcase value="www.site2.com,site2.com">
      <cflocation addtoken="No" url="http://www.site2.com/site2/index.cfm">
   </cfcase>
</cfswitch>
waterswing


Joined: 27 Apr 2004
Posts: 4
Reply with quote
Instead of using cflocation to redirect to another page you could also use cfinclude to include the right page - then you'd keep the domain/url in the address bar - if that's a point for you.
Relative links that aren't related
jamie
HostMySite Sales Rep
HostMySite Sales Rep

Joined: 19 Mar 2004
Posts: 766
Location: Newark, De
Reply with quote
Good point - also bear in mind your linking schema. In other words, when you program a link into your code, if it's relative then the link assumes the filepath used is the one currently in your URL bar. If both domains point to the same place, this probably won't be an issue, however if you CFLOCATION down to a subdirectory, your relative links may be pathed wrong.

This usually doesn't come up when discussing subdomains - I see it far more often when clients take advantage of our shared SSL, which gives them a secure website, but on a different domain:

https://wwwXX.safesecureweb.com/USERNAME

Since that's a different domain than their primary site, clients often find themselves 'coded into a corner' when trying to make use of the shared SSL.
One Domain, Multiple Sites.
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic