【发布时间】:2013-07-10 14:07:20
【问题描述】:
我们在 IIS7.5 上有以下重写规则(在 James Moberg 回答后重写):
<rule name="Anything else to the event handler" enabled="true" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{PATH_INFO}" pattern="^.*(/index.cfm/).*$" negate="true" />
</conditions>
<action type="Rewrite" url="/index.cfm/{R:1}" appendQueryString="true" logRewrittenUrl="true" />
</rule>
但是,它从不将/{R:1} 放在其后面。它只是转到/index.cfm。我们需要实际获取引用变量,因为我们在 ColdFusion (10) 脚本中使用了它。我们想要的示例 url 重写:
发件人:http://www.my-site.com/this.is.a.test/another.test
收件人:http://www.my-site.com/index.cfm/this.is.a.test/another.test
有人知道为什么不这样做吗? (快速提示:执行正确的 URL 时可能会出现 ColdFusion 错误,但我认为这不会导致重写问题?)
注意,当您在浏览器中尝试相同的操作(禁用规则)时,它确实有效 - 只是没有重写规则。使用重写规则,CF 中的cgi.PATH_INFO 变量返回空字符串。
另外,IIS 确实说它在日志中将 URL 重写为 index.cfm/this.is.a.test/another.test,这很奇怪。
【问题讨论】:
标签: iis coldfusion rewrite