I am tasked with fixing an issue in some rewrite rules that someone else wrote and can't figure out a solution...
The existing rule removes the .asp extension off files on our server. The trouble is that there are a few occasions where there is a folder and file with the same name once the extension has been stripped. For example:
/pages/example [a folder]
/pages/example.asp [a file]
...strip the .asp off the file and it then clashes with the folder.
For various reasons I can't just change the file/folder name to avoid the clash so I need to add something to the rule to avoid the clash.
The existing rules look like this:
<rule name="Strip off .asp extension" stopProcessing="true" ><match url="(.*)\.asp" /><action type="Redirect" url="{R:1}" /></rule><rule name="Show asp page without extension" ><match url=".*" negate="false" /><conditions><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /><add input="{URL}" pattern="(.*)\.(.*)" negate="true" /></conditions><action type="Rewrite" url="{R:0}.asp" /></rule>
Its okay if in this situation the .asp does not get stripped off. So I need to say something like "if IsFile AND IsDirectory then ignore rules".
Any help appreciated!!
John