Iis 7 使用web配置从url中删除index.cfm

Iis 7 使用web配置从url中删除index.cfm,iis-7,coldfusion,url-rewriting,web-config,cfwheels,Iis 7,Coldfusion,Url Rewriting,Web Config,Cfwheels,快速问题- 目前,我的URL如下所示:index.cfm/camp/other test 我希望他们看起来像这样:camp/另一个测试 我可以用.htaccess在apache上做得很好,但我需要用web.config在iis7上做得很好。以下是我迄今为止的重写: <rewrite> <rules> <rule name="Remove index.cfm" enabled="true"> <match url="^(.*)$"

快速问题-

目前,我的URL如下所示:
index.cfm/camp/other test

我希望他们看起来像这样:
camp/另一个测试

我可以用.htaccess在apache上做得很好,但我需要用web.config在iis7上做得很好。以下是我迄今为止的重写:

<rewrite>
  <rules>
    <rule name="Remove index.cfm" enabled="true">
      <match url="^(.*)$" ignoreCase="true" />
      <conditions logicalGrouping="MatchAll">
        <add input="{SCRIPT_NAME}" negate="true" pattern="^/(assets|files|miscellaneous|robots.txt|favicon.ico|sitemap.xml|index.cfm)($|/.*$)" />
      </conditions>
     <action type="Rewrite" url="/index.cfm/{R:1}" />
    </rule>
  </rules>
</rewrite>


谢谢你的帮助

我认为CFWheels要求您通过rewrite.cfm而不是index.cfm路由重写请求

见克里斯·彼得斯的评论

如果您调整:

<rewrite>
  <rules>
    <rule name="Remove index.cfm" enabled="true">
      <match url="^(.*)$" ignoreCase="true" />
      <conditions logicalGrouping="MatchAll">
        <add input="{SCRIPT_NAME}" negate="true" pattern="^/(assets|files|miscellaneous|robots.txt|favicon.ico|sitemap.xml|index.cfm)($|/.*$)" />
      </conditions>
      <action type="Rewrite" url="/index.cfm/{R:1}" />
    </rule>
  </rules>
</rewrite>

致:


它应该可以解决您的问题,前提是您具备:

<cfset set(URLRewriting = "On")>


在/config/settings.cfm中尝试添加此重写规则:

    <rewrite>
      <rules>
        <rule name="ColdFusion on Wheels URL Rewriting" enabled="true">
          <match url="^(.*)$" ignoreCase="true" />
          <conditions logicalGrouping="MatchAll">
            <add input="{SCRIPT_NAME}" negate="true" pattern="^/(flex2gateway|jrunscripts|cfide|CFFileServlet|cfformgateway|railo-context|files|images|javascripts|miscellaneous|newsletters|stylesheets|robots.txt|favicon.ico|sitemap.xml|rewrite.cfm)($|/.*$)" />
          </conditions>
          <action type="Rewrite" url="/rewrite.cfm/{R:1}" />
        </rule>
      </rules>
    </rewrite>


是的,我查看了索引和重写,错误地认为它们是相同的,但查看问题后,我发现Wheels处理请求的方式不同。我将它改为使用rewrite.cfm,但它仍然只在url为/rewrite.cfm/camp/test时有效。我启用了URLRewiting,它控制生成的链接到URL的格式。谢谢你提供的信息@dspz您使用的是什么版本的IIS?我使用的是iis7,重写模块2.0。我知道重写是活跃的,它只是没有做我想做的。@dspz好的,请耐心听我说。我碰巧有一个IIS7开发服务器和一个CFWheels应用程序,它正经历着与您所解释的完全相同的行为。我编辑了我上面的帖子,以反映我所做的改变,使事情得以顺利进行。我将matchType=“Patten”和ignoreCase=“true”添加到条件中,这使得重写工作对我有效。让我知道你过得怎么样。试过了,可惜运气不好。不过,我确实发现了更多细节。我使用的是Coldroote插件,看起来这个web.config默认为根路径。当我访问/camp/test时,它只是显示索引页,没有错误。我甩了params,不管url是什么,它都显示root作为路由。这正是上一个人在你之前一个月所说的。@coderpros但这是正确的,值得投否决票吗?
    <rewrite>
      <rules>
        <rule name="ColdFusion on Wheels URL Rewriting" enabled="true">
          <match url="^(.*)$" ignoreCase="true" />
          <conditions logicalGrouping="MatchAll">
            <add input="{SCRIPT_NAME}" negate="true" pattern="^/(flex2gateway|jrunscripts|cfide|CFFileServlet|cfformgateway|railo-context|files|images|javascripts|miscellaneous|newsletters|stylesheets|robots.txt|favicon.ico|sitemap.xml|rewrite.cfm)($|/.*$)" />
          </conditions>
          <action type="Rewrite" url="/rewrite.cfm/{R:1}" />
        </rule>
      </rules>
    </rewrite>