I am having an issue trying to get the rewrite working in IIS7 web.config.
I need URLs like /err/interaccess to be rewritten to /err/404new.asp (not a redirect,as I don’t want to expose the file.
I tried the following and it only works if I use /interaccess but not /err/interaccess
<rule name="Rewrite Interaccess Error" enabled="true" stopProcessing="true">
<match url="^tinteraccess$" />
<action type="Rewrite" url="/err/404new.asp" />
</rule>
Any idea on why? I tried to find documentation on this and could not find anything regarding this usage.
The magic is in the regular expression of the
<match>tag. To make it match your exact URL you would use:If you would want to match everything under
/err/you would use:This is all very well documented, e.g.: http://www.iis.net/downloads/microsoft/url-rewrite (see Related Learning)