2014-11-14 62 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>