![]() |
| One Domain, Multiple Sites. |
|
mtangorre
|
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
![]()
|
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
|
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:
|
||||||||||||||
|
|
|||||||||||||||
|
waterswing
|
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
![]()
|
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. |
|
||
|



