URL ReWrite configuration redirect all .htm to .cfm

We have Micrsoft's URL ReWrite installed on Windows Server 2012 R2 IIS 8.5, and wish to redirect system-wide any incoming traffic to any .htm file to be directed instead the corresponding .cfm file located in the same folder.  The .htm files existed previously but we can't seem to get .htm to work, even after changing the Handler Mappings and other CF Files others have recommended to edit.

The following  is not working for me. There is no  error but the .htm file which has ColdFusion code, does not process or redirect to the .cfm file. There are too may .htm files system wide to change easily.

I'm editing the web.config file directly because the IIS URL ReWrite is just far too alien for me.

What am I doing wrong in my code? Please only respond if you can see what I'm doing wrong and you believe you have a fix in the web.config file, or can show me exactly how to use the IIS 8  URL Rewrite Module to get this done.

This web.config file is in our web root directory and also where the .htm file is located we're testing.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <system.webServer>
<rewrite>
     <rules>
  <rule name="htm to cfm" stopProcessing="true">
    <match url="(.+).htm$" />
    <action type="Redirect" url="{R:1}.cfm" />
  </rule>
</rules>
</rewrite>
         <defaultDocument>
            <files>
                <add value="default.cfm" />
            </files>
        </defaultDocument>
        <security>
            <requestFiltering>
                <fileExtensions>
                    <add fileExtension=".cfm" allowed="true" />
                    <add fileExtension=".htm" allowed="true" />
                </fileExtensions>
            </requestFiltering>
        </security>
    </system.webServer>
</configuration>
Grover McBroomAsked:
Who is Participating?

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

x
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.

David Johnson, CD, MVPOwnerCommented:
url rewrite isn't that smart.  I am guessing that you have a bunch of files you converted from .htm to .cfm but still have the url's pointing to .htm  

you had almost the same queston
http://www.experts-exchange.com/questions/28706616/Map-IIS-8-5-Coldfusion-11-to-process-htm-files-same-as-cfm-files.html in which you said the rewrite rules worked properly?

Your problem was that cold fusion wasn't being invoked with .cfm files
Which version of CF are your using?
Grover McBroomAuthor Commented:
You guessed right on the cfm / htm files.

Using CF11 Enterprise, licensed entered and all updates installed on Windows Server 2012 R2.

Can you show me how to do this in web.config example by modifying my code?
gheistCommented:
Do you need help with apache or IIS ? They both can do what you want.
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

Grover McBroomAuthor Commented:
This  is IIS version 8.5.
gheistCommented:
Does this help:
https://www.iis.net/downloads/microsoft/url-rewrite#additionalDownloads
Or if you really intend to change pages to not have htm, a trial of commercial apache htaccess parser is here for 45 days:
https://www.helicontech.com/ape/download.html
Grover McBroomAuthor Commented:
Thanks for the suggestion.

After closing this question, I found the answer (not here on EE) and did some substitution. This is what I was looking for:

<rewrite>
  <rules>
<rule name="Map htm to cfm" stopProcessing="true">  
  <match url="(.*)\.htm$" />  
  <action type="Redirect" redirectType="Permanent" url="{R:1}.cfm" />  
</rule>
  </rules>
</rewrite>

It works when placed into the root web.config file.


I downloaded the trial version, installed it and will look into it in more depth.

Just one note so far and best left for Helicon if they ever read this or for anyone installing Helicon Ape:

 I'm not at all impressed with the way, once installed, that Helicon Ape disables all websites. Took me far too long to find the program, then discover the method to disable it. Helicon's default mode after installation should be 'disabled' to avoid all the errors seen by tons of users on all 11 sites with the Helicon banner and advertisement.  Also, and this is just for them, their interface looks a bit amateurish. But serves me right for placing this program on a production server. I hope once I get into the program, l'll find Helicon is more careful and intelligent.

In regard to my original question: I had hoped someone would have simply given me a few lines to show how to redirect .htm to .cfm with the Microsoft URL ReWrite tool I installed. As I said above, I found the solution myself but wished someone here was able to point it out,. That would haved saved me lots of time.

But because because I keep getting these notices that I have "Abandoned" this question, I'll give you the points for no other reason other than to end it. That happens lots, except when _agx_ gives the answer. He's the king as far as I can tell.

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:
Looks like that has already been done, not by me but someone else, okay by me.  Hope this is finally closed.
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
Microsoft IIS Web Server

From novice to tech pro — start learning today.