user2173353
user2173353

Reputation: 4640

IIS rewrite fails

I want to rewrite this URL: https://localhost/My/Test.dll into this: https://localhost:444/Api/Test (It is a GET mvc action)

I use this rule:

<rule name="Rewrite rule1 for Thing 2" patternSyntax="Wildcard" stopProcessing="true">
    <match url="*" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{QUERY_STRING}" pattern="*/My/Test.dll" />
    </conditions>
    <action type="Rewrite" url="https://localhost:444/Api/Test" appendQueryString="false" />
</rule>

Any idea why I get a 404 errror when hitting https://localhost/My/Test.dll with my browser? I have URL Rewrite installed. Do I also need to install Application Request Routing?

Upvotes: 0

Views: 466

Answers (1)

Douglas
Douglas

Reputation: 54887

The string you are attempting to match is not the query string, but the path in the URL. Try the following instead:

<rule name="Rewrite rule1 for Thing 2" patternSyntax="Wildcard" stopProcessing="true">
    <match url="My/Test\.dll" />
    <action type="Rewrite" url="Api/Test" appendQueryString="false" />
</rule>

Upvotes: 1

Related Questions