Recently, I was involved in migrating a ColdFusion 7 website running on IIS 6 to GoDaddy’s Windows/ColdFusion hosting. Right off the bat, I ran into a problem with CFInclude.
Here’s a sample of my code before the migration:
The path here on the IIS server referenced the site root – meaning that the include file would have been found at the path http://www.example.com/includes/pageheader.cfm. This was failing outright on GoDaddy’s server. Previously, this had worked at any level of my site, no matter how many subfolders deep I was.
I tried this revision that worked as long as files were in the root of the site:
Notice the addition of a single dot in the template path. This revision failed when I tried to use it in any subfolders.
I ended up using the following code to remedy my problems:
<cfset PathMod = '../'>
And for any sub-subfolders, I modified the PathMod variable to have the requisite number of “../” pairs.
Then there was the CSS problem. In my CSS file(s), I had been using a similar path structure for any URL’s. So to include a background graphic I used this CSS:
background: url(/images/NAT-topnavbar-repeater.gif) repeat-x;
Then I read somewhere that CSS URL paths are relative to the location of the CSS file, not to the page it’s linked from. So that meant simply updating all my CSS URL’s to look like this:
background: url(../images/NAT-topnavbar-repeater.gif) repeat-x;
Once I made these changes, the migration was complete.