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

0

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

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

web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <directoryBrowse enabled="true" />
        <defaultDocument>
            <files>
                <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" />
            </files>
        </defaultDocument>
    </system.webServer>
</configuration>
iis
coldfusion
cfml
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