请求URL时如何取回.cfm扩展名

时间:2019-05-03 07:27:40

标签: iis coldfusion cfml

首先,我尝试使用IIS URL重写模块请求不带.cfm扩展名的页面,并且成功。现在,我想将我的.cfm扩展名恢复为所请求的URL。

我像以前一样更改了web.config文件,并卸载了URL重写模块。我的网站中的某些页面使用.cfm扩展名访问,即使文件存在,也会引发此错误:

  

HTTP错误404.0-找不到,错误代码-0x80070002


我已经用它来重写

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

0 个答案:

没有答案