How to get back the .cfm extension when requesting a URL


At first, I tried to request my pages without a .cfm extension, using the IIS URL rewrite module and was successful. Now, I want to get back my .cfm extension to the requested URL.

I changed my web.config file as before and uninstalled the URL rewrite module. A few pages in my website are accessed with a .cfm extension and are throwing this error, even though the file exists:

HTTP Error 404.0 - Not Found , Error code - 0x80070002

I have used this for rewriting

    <rule name="Hide .cfml ext">
      <match url="^(.*)" ignoreCase="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        <add input="{REQUEST_FILENAME}.cfml" matchType="IsFile" />
      <action type="Rewrite" url="{R:0}.cfml" />
    <rule name="Redirecting .cfml ext" stopProcessing="true">
      <match url="^(.*).cfml" />
      <conditions logicalGrouping="MatchAny">
        <add input="{URL}" pattern="(.*).cfml"  />
      <action type="Redirect" url="{R:1}" />


<?xml version="1.0" encoding="UTF-8"?>
        <directoryBrowse enabled="true" />
                <clear />
            <add value="index.cfm" />
                <add value="home.cfm" />
                <add value="Default.htm" />
                <add value="Default.asp" />
                <add value="index.htm" />
                <add value="index.html" />
                <add value="iisstart.htm" />
                <add value="default.aspx" />
asked on Stack Overflow May 3, 2019 by Madhu • edited May 3, 2019 by Community

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0