0
votes

I'm running CF9 Developer on Apache to run a testing server on my computer for multiple domains whose sites are ultimately hosted remotely. Everything works, but I can currently only use the "/" root mapping on one. Here are my local domains:

  • local.domain1.com
  • local.domain2.com
  • etc...

And here are there physical paths:

  • C:\www\domain1.com\
  • C:\www\domain2.com\

In CF Administrator, I have the following Active ColdFusion Mapping: (Logical Path: "/" - Directory Path: "C:\www.domain1.com\"). This works for local.domain1.com. However, I can only add one "/" logical path in CF Administrator.

In other words, domain 1 will sucesfully load cfinclude template="/anyrootfolder/anyfile.cfm" because it's root is mapped. Domains 2, 3, etc, will fail if I try to use cfinclude template="/anyrootfolder/anyfile.cfm" because the "/" root is not mapped.

Any suggestions how I can map multiple "/" on the same server?

EDIT:

As referenced in my comments under Al's answer, I discovered that all domains were grabbing from domain1's file structure whenever I used an absolute path on a cfinclude. In CF Administrator, I deleted the Active CF Mapping with Logical Path "/" and Directory Path "C:\www\domain1.com\", and this seemed to do the trick. I'm not sure why that was in there (maybe as part of the default CF setup process?). Anyway, I don't see any errors as a result of deleting it to either test site, and my other domains now work as expected (probably because I already had the document roots set up under Apache's config? [See RobG's answer.]) Thanks all!

3

3 Answers

2
votes

I don't think you need this mapping at all. On my local machine, I would put your local.domainX.com entries in your Hosts file (C:\windows\system32\drivers\etc\host), and then configure a virtual directory in Apache for each one.

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "C:\www\domain1.com"
ServerName local.domain1.com
</VirtualHost>

Let me know if you need more info on the Apache config.

1
votes

Can you not use application-level mappings for /?

In Application.cfc

<cfset THIS.mappings["/"]="C:\www\domain2.com\">
0
votes

I death with this a long time ago dealing not only with multiple sites on a test machine but with multiple sites on the same production server. My eventual solution was to create a base three character "prefix" mapping for each site.

As such, typical cfincludes would be...

<cfinclude template="/tqs/home.cfm">
<cfinclude template="/bqo/home.cfm">

Note that this also allows you to reference files, images, and other resources that might be saved on one of your other sites.

<cfcontent file="#expandpath("/bqo/images/pixel.gif")#" type="...