我有一个网站,它使用index.cfm作为整个站点的默认页面。Varibles在url中传递为由正斜杠分隔的值部分。
示例:
www.domain.com/index.cfm/show_register/memberType_Buyer/membershipLevel_Vip
www.domain.com/index.cfm/show_register/memberType_seller/membershipLevel_Standard
www.domain.com/index.cfm/show_items/category_bike/id_123我想“隐藏”index.cfm在网址,但它仍然有效。
我尝试使用我发现的许多不同的规则(最新的存在)。
<rewrite>
<rule name="Default Document" stopProcessing="true">
<match url="(.*)index.cfm" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
<add input="{PATH_INFO}" pattern="^.*(index.cfm/).*$" negate="true" />
<add input="{QUERY_STRING}" pattern=".+" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" url="{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
</rewrite>但我似乎不能让它正常工作。我觉得因为index.cfm是站点的默认文档,所以我可能处于某种无限循环中。
我哪里出问题了?
更新:我已经重新安装了。

这就是我在IIS中看到的

这就是浏览器正在显示的内容。

我确实让这个重写开始工作了,但是现在它正在将"index.cfm“添加到包括/js/global.js和/css/site.css这样的所有文件中。
<rules>
<rule name="Default Document">
<match url="\/(.*)" />
<action type="Rewrite" url="index.cfm{R:0}" />
</rule>
</rules>所以,虽然我离得越来越近,但我并不完全在那里。
发布于 2017-07-30 05:24:53
这个重写规则将为您做到这一点:
<rule name="Default Document" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
<add input="{PATH_INFO}" pattern="^/index.cfm" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/index.cfm/{R:0}" />
</rule>它将重写请求:
www.domain.com/show_register/memberType_Buyer/membershipLevel_Vip到www.domain.com/index.cfm/show_register/memberType_Buyer/membershipLevel_Vip
https://stackoverflow.com/questions/45394619
复制相似问题