问题
I have the following rewrite rule set up on IIS 7:
<rule name="Rewrite /publicfiles/GUID/file.ext" stopProcessing="true">
<match url="^/?publicfiles/(.*)/(.*)" />
<action type="Rewrite" url="http://www.domain.tld" appendQueryString="false" /
</rule>
When I try it out it appears to not fire. I get a 404 error, but if I change the type to Redirect it fires and sends me to the URL specified. Is someone able to shed some light on this?
EDIT: I added the definition of the rule to the web.config of my IIS server rather than my site and then it worked perfectly. However this is not very feasible as I need to configure the rule for individual sites. Any ideas?
回答1:
It wasn't about the global rule after all. It turned out I had to install Application Request Routing and then it worked with a site rule :)
来源:https://stackoverflow.com/questions/14874159/iis-7-rewrite-rule-not-firing-but-does-work-with-redirect