Maritim
Maritim

Reputation: 2159

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

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?

Upvotes: 0

Views: 1436

Answers (1)

Maritim
Maritim

Reputation: 2159

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 :)

Upvotes: 3

Related Questions