2014-11-14 58 views
0

我想删除URL中的index.cfm,如果没有query_string例如www.mysite.com/index.cfm将被重写为www.mysite.com,并且'www.mysite.com/Test/index.cfm将被重写为'www.mysite.com/Test/,但是如果URL中存在查询字符串,则URL将不会受到影响,例如,重写规则不会影响'www.mysite.com/Test/index.cfm?u=5通过IIS URL重写删除index.cfm

我该如何得到它?

+0

怎么样使用'www.mysite.com/Test/?U = 5'呢? – user3071284 2017-07-24 15:14:49

回答

0

这工作适合我

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