IIS 7 - Rewrite rule not firing, but does work with Redirect

风流意气都作罢 提交于 2021-02-11 17:58:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!