process files without .cfm extensions as coldfusion

bradderick used Ask the Experts™

I have a dedicated windows server that currently hosts websites that are coded in .asp, .php and .cfm.

In addition, the server has a working coldfusion server.

All websites work fine, however, 2 of them are due to re-coded in coldfusion and they have .php and asp file extensions.

I would like to preserve the existing asp and php filenames and get them to execute as cold fusion files rather than as .php and .asp files. Each file will have all of the php and asp code stripped and purely have html & coldfusion code.

How can I get specific websites to interpret the .asp and .php files and process them through coldfusion. Note I do not want all .php and .asp files on the server to be processed as coldfusion, just the files on two websites.  I have had a problem before where all  php files were mapped to coldfusion and it made a lot of websites stop working.

Many thanks,

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

You have to make changes to CF config files and IIS

the documentation will say .htm, but you would want .php, etc...

It seems that this can be done for a website because you go into a website settings, but I think it ends up being global for the server.   I set it up on one website, and it works on all... ! CAUTION !

Most Valuable Expert 2015

(no points ...)

Maybe you could use some sort of url rewrite rules so it works more selectively (ie on some pages or sites, not all).  Unfortunately, I haven't done it so I don't know the details. But I *think* it might be possible.
I would definitely recommend using a URL Rewriter. If you are using IIS you can use ISAPI_Rewrite ( or if you are using a Linux based web server they all have rewriting support.

RewriteRule (.*)/(.*)\.php(.*) /$2.cfm [I]

The rule above should work for what you want. Let me know if you have any difficulties.
Most Valuable Expert 2015

Is that an expression for multiple sites?
If you want to redirect other extensions to cfm then just add more rules...

RewriteRule (.*)/(.*)\.php(.*) /$2.cfm [I]
RewriteRule (.*)/(.*)\.asp(.*) /$2.cfm [I]

Most Valuable Expert 2015

No, my question was how to adapt that expression to *only* apply to particular sites, not all.  That's what the OP seemed to be asking :)
Just put the .htaccess in the root of the site that you want to redirect. The htaccess file contains the rules that apply to that site only.


thank you. appreciate the help

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial