I wrote a simple rewrite rule so that I can remove .aspx from all paths to the page.
Thus, if someone dials http://www.domain.com/Contact , they will be sent to the contact page, instead of entering http://www.domain.com/contact.aspx .
The following rule works fine, except if the file name contains a period. I donβt want the rule to apply, because even I thought that I had a condition to deny when url is a file or directory, this does not apply to handlers and other special files. To avoid this problem, I deny special files, adding a condition for each of them is no longer working, because there are quite a few special circumstances that arise, and I do not want to write a new one for each particular case.
Basically, I just need to add a condition when there is a period in the file name in order to nullify it. Can anyone help? I'm not so good at regular expressions.
<rule name="RewriteASPX" stopProcessing="true" enabled="true"> <match url="(.*)" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="{R:1}.aspx" /> </rule>
source share