Hello all,
I'm pretty new to the rewrite module so I hope you can help me.
I have a current rule to rewrite:
mysite.com/info/report/xxx
to:
mysite.com/info/report/xxx.htm
where xxx is any combination of at least one alphabetic character.
My rewrite rule is:
<rule name="Rewrite info/report/xxx" stopProcessing="true">
<match url="^info/report/([A-Za-z]+)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="info/report/{R:1}.htm" />
</rule>
So far so good. But there will be times where a user will make a request but the matching .htm file does not exist. For example, if someone tries mysite.com/info/report/AAA but mysite.com/info/report/AAA.htm does not exist. Instead of getting the site's 404 error, is there a way I can check first to see if the matching .htm file exists? If it does, then go ahead with the Rewrite as above. If it doesn't, then redirect to a special page, like info/report/noreport.htm.
I've been searching for a few days now and I have not found a condition which involves checking to see if a file exists. And I don't think IsFile is the same condition I'm talking about.