Reputation: 165
I want to remove the index.cfm in the URL if there is there is no query_string e.g. www.mysite.com/index.cfm
would be rewritten to www.mysite.com
and 'www.mysite.com/Test/index.cfm
would be rewritten to 'www.mysite.com/Test/
but if there is querstring in the url then url would not be affected e.g. 'www.mysite.com/Test/index.cfm?u=5
would not be affected by rewrite rule.
How can I get it?
Upvotes: 1
Views: 987
Reputation: 165
This works perfect for me
<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>
Upvotes: 1