Map IIS 8.5 / Coldfusion 11 to process .htm files same as .cfm files.

I've tried several suggestions I found on the net to change web.xml and other files, stop cf, then start again, but nothing seems to work.
Search engines have indexed important .htm files so I'm not about to change them to .cfm just to get the system to work. There must/should be a very simple way to do this, hopefully.

So, how can I map all my .htm files to act just as though they were .cfm. I tried using IIS 8.5's Handler Mappings. If that this is the solution then I must not understand the process and really
need detailed help because it did not work.

I'm using ColdFusioin 11 on Windows Server 2012 R2.

For a workaround I used the IIS ReWrite tool. Here's the contents of my "web.config" file:

<?xml version="1.0" encoding="utf-8"?>
      <defaultDocument enabled="true">
            <add value="home.cfm" />
             <rule name="Redirect htm to cfm" stopProcessing="true">  
  <match url="(.*).htm$" />  
  <action type="Redirect" redirectType="Permanent" url="{R:1}.cfm" />  

But of course, this forced me to create a corresponding cfm file for every htm file. But it does work.

So, hoping someone will show me exactly how to get htm files to render just like cfm files which was quite easy to do back in CF8 and IIS6.
Grover McBroomAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dan McFaddenSystems EngineerCommented:
Have you modified the "" file as well?

reference link:

Grover McBroomAuthor Commented:
Dan - That looked very promising but did not work for me. It may because I have another problem:

HTTP Error 500.0 - Internal Server Error

I get this whenever a ColdFusion module is run (.cfm) except when that file is the default document for the site.  

Example:  (if the default document residing in the site root has been defined as 'index.cfm' then the ColdFusion code is executed correctly. It makes no different which ColdFusion document it is, it runs fine.

But with the following example, it does not run correctly:  If it's a cfm file, it generates the Error 500. If its an .htm file, no error. If the .htm file has CF code, there is no error but the code is not executed, just seen as though a text file.

So, unless the .cfm file is the default document when run it generates the Error 500, no matter where the file is stored or which folder. Same is true of any links to a .cfm file.  

So, ColdFusion does work, at least with the default document so I'd think this idea should point to a clue for you experts. The Web.Config file looks fine. Application pool is set for Default-AppPool but I've tried different settings with the same result. The virtual directories were created when I used the Web Configuration Tool but there was an error during the process:

Error: < message: Cannot find requested collection element.
ERROR < message: New add object missing reqired attribute. Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to cfrHandler'

The error did not seem to be fatal because the virtual directories were created, including /CFIDE.

Here's the web.config

<?xml version="1.0" encoding="UTF-8"?>
                <remove value="index.cfm" />
                <remove value="index.htm" />
                <remove value="default.aspx" />
                <remove value="iisstart.htm" />
                <remove value="index.html" />
                <remove value="Default.asp" />
                <remove value="Default.htm" />
                <add value="index.cfm" />

As you can see I removed the ReWrite Tool so as not to complicate the problem and better understand what's going on.

Does the Web Platform Installer in IIS need to be run, including Microsoft Azure Powershell and Cross-platform Command Line Tools? I just installed both but don't see any obvious options or changes.

Then there's the IIS 8 "Configuration Editor". I've not touched it. Do I need to do something with it?  Would be great to find some documentation there for "Build a Classic ColdFusion website on IIS." There are tons of options within that editor but where does one begin? This is so complicated without any guide for the basics to be sure everything is installed correctly and when those generic error code flash, they are not much help.  So, that's why I'm here, hoping and knowing probably I've missed some simple basic step. But which one out of the hundreds or perhaps thousands offered in a multitude of confusing hodgepodge files and categories!!

Maybe there's much more I should do to make the web.config file solve the problem but I don't have a clue and cannot find any good, fool-proof help on exactly what needs to be done to get ColdFusion 11 specifically working on IIS 8.5 and Windows 2012 Server r2. If you know of one and have no other suggestions, please forward me the link.
Dan McFaddenSystems EngineerCommented:
Can you post (or PM) the handler mapping you configured?

Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

Grover McBroomAuthor Commented:
Dan - Handler mapping? Sure will but what is it? Where would I find it, in IIS 8 configuration, in a file somewhere?
Adam BrownSr Solutions ArchitectCommented:
I'm not too experienced with ColdFusion integration with IIS, but my GoogleFu and a little creativity came up with this process. Not sure if it will work, but it seems to be as many pieces as are needed put together from various sources and modernized to work with IIS 8+:

1.      ColdFusion needs to be configured to process HTML files, which step 1 at this site covers:
2.      IIS needs to be configured to with the appropriate handler mapping for ColdFusion to be used. The link above gives instructions for doing this in IIS6, but IIS 8.5 does configuration differently, so I had to come up with some instructions on that. From what I can tell, you would want to add a Module Mapping that points to the ColdFusion application, as explained in the above link, but following these steps:
a.      Open IIS, go to the Website you want to modify
b.      Open Handler Mappings
c.      Right Click, Select Module Mapping
d.      Enter *.htm for the Request Path (Make another handler for *.html if you like)
e.      Enter the path to ColdFusion handler in Executable
f.      Click Request Restrictions, go to Access Tab, select Execute
g.      Select a Module…I am not certain which one to select. IsapiModule may work, but you might try fiddling with this piece of things don’t work right using that one. I don’t have ColdFusion on my server, so that may actually show up in the list of modules for you. If it does, use that.
h.      Put ColdFusion HTML Mapper in Name (Or whatever you want)
3.      Once that’s set up, modify the file as instructed here:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Grover McBroomAuthor Commented:
You may be on the right track, not sure. I could not get it to work. I tried many different variation, script or execute, stopped and started cf each time but the general result is a variation of this error:

HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.

Most likely causes:
The request matched a wildcard mime map. The request is mapped to the static file handler. If there were different pre-conditions, the request will map to a different handler.

Things you can try:
If you want to serve this content as a static file, add an explicit MIME map.

Detailed Error Information:
Module         StaticFileModule
Notification         ExecuteRequestHandler
Handler         StaticFile
Error Code         0x80070032
Requested URL
Physical Path              C:\server\server\home.cfm
Logon Method      Anonymous
Logon User             Anonymous

The domain info was substituted of course.

The main problem is getting ColdFusion modules to work correctly, not a CF problem but IIS 8.5.

So, let's put the problem of not being able to use .htm files containing cf code away as that's secondary. I could workaround that problem if I need to.

Again, if the default document is a cf file (.cfm) it executes correctly when just the domain or folder is given in the url as my example gave:  - Default document index.cfm runs fine. It makes no different which ColdFusion document it is, it runs fine if it is the default document but not shown in the URL or LINK.

But with the following example, the .cfm file does not run correctly:  If it's a cfm file, it generates the Error 500. If its an .htm file, no error. If the .htm file has CF code, there is no error but the code is not executed, just seen as though a text file.

So, it's best for me to close this, award you the points for the great effort, which may be close to being correct. But I have a feeling we'll never know until the main problem is found and corrected.

If and when the problem is found, I'll try to return here to post it.

I found the answer elsewhere. This works if you place it into the root web.config file.

<rule name="Map htm to cfm" stopProcessing="true">  
  <match url="(.*)\.htm$" />  
  <action type="Redirect" redirectType="Permanent" url="{R:1}.cfm" />  
As previously mentioned, add the servlet mappings, edit the file, and then in the IIS config for the site in question, open the Handler Mappings configuration and EDIT the entry for cfmHandler. In the form, change "*.cfm" to "*.cfm,*.htm". Save. Restart IIS. Done.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.