Want to run ColdFusion code on a page but don’t want the .cfm extension?
Or you have existing pages with an extension of .html and want to add CF code?
You need to update CF and IIS.
These instructions apply to ColdFusion version 9 and IIS 7+.
For this example, we will make updates to support running ColdFusion in files with an .html extension under IIS.
ColdFusion
-
In a text editor, open web.xml from one of the following locations(back it up first):
· Multi-server: (jrun_root)\servers\htmlMappings\cfusion.ear\cfusion.war\WEB-INF\web.xml
· Single server: (cfroot)\wwwroot\WEB-INF\web.xmlSingle server example path:
C:\ColdFusion9\wwwroot\WEB-INF\web.xml -
Find this block of code:
<servlet-mapping id="coldfusion_mapping_14"> <servlet-name>CFFileServlet</servlet-name> <url-pattern>/CFFileServlet/*</url-pattern> </servlet-mapping>
-
Add this block directly below it (notice the ids):
<servlet-mapping id="coldfusion_mapping_15"> <servlet-name>CfmServlet</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> <servlet-mapping id="coldfusion_mapping_16"> <servlet-name>CfmServlet</servlet-name> <url-pattern>*.html/*</url-pattern> </servlet-mapping>
You can add additional code blocks for files with other extensions. Just make sure to update the ids with sequential numbers and add entries into IIS.
-
Save the file and restart ColdFusion. The easiest way to restart ColdFusion, under Windows:
Control Panel > Administrative Tools > Services >
Right-click “ColdFusion 9 Application Server” and select “Restart”
IIS
Select your site in IIS Manager.
-
Goto “Handler Mappings” and find the entry with *.cfm:
Double-click it and copy the “Executable” path.
Close the dialog window. -
In right sidebar, click “Add Script Map”.
Enter the following:
“Request Path”: *.html
“Executable”: (paste from clipboard)
“Name”: Coldfusion html (this can be whatever you want)
Click OK to save. - Restart your site in IIS.
You should now be able to run ColdFusion code in files with an .html extension!
Great books are available on ColdFusion here.
Thanks to my father who told me concerning this webpage, this weblog
is genuinely awesome.