Skip to main content
Inspiring
February 1, 2017
Question

Absolute Links & Mappings

  • February 1, 2017
  • 1 reply
  • 1399 views

I am trying to setup a new site that is using absolute links.

Every page I run gives me this type of error below (Could not find the included template /includes/..........) See below for full error

How do I correct this?

In the CFadmin > Server Settings > Mappings or

IIS mappings

or

some code in application.cfc

Could not find the included template /includes/head.cfm.

Note: If you wish to use an absolute template path (for example, template="/mypath/index.cfm") with CFINCLUDE, you must create a mapping for the path using the ColdFusion Administrator. Or, you can use per-application settings to specify mappings specific to this application by specifying a mappings struct to THIS.mappings in Application.cfc.
Using relative paths (for example, template="index.cfm" or template="../index.cfm") does not require the creation of any special mappings. It is therefore recommended that you use relative paths with CFINCLUDE whenever possible.
This topic has been closed for replies.

1 reply

Inspiring
February 1, 2017

Not sure what to answer here that hasn't already been said - the answer is in the text you posted:

Note: If you wish to use an absolute template path (for example, template="/mypath/index.cfm") with CFINCLUDE, you must create a mapping for the path using the ColdFusion Administrator. Or, you can use per-application settings to specify mappings specific to this application by specifying a mappings struct to THIS.mappings in Application.cfc.

Using relative paths (for example, template="index.cfm" or template="../index.cfm") does not require the creation of any special mappings. It is therefore recommended that you use relative paths with CFINCLUDE whenever possible.

If you use CFINCLUDE then you will use a relative path (i.e. my_include.cfm)

Otherwise use a mapping in coldfusion to point to the include and reference that mapping. So in Coldfusion admin you would set a the logical path to "/my_includes" and the directory path to "C:/cf/my_includes/"

Then you can set the CFINCLUDE to be "/my_includes/my_include.cfm"