Max Favilli
Max Favilli

Reputation: 6449

IIS rewrite all request to a static url

I have http://xyz.it/page1 to http://xyz.it/pageN and I need to redirect all pages to http://bar.it/foo and I thought I had solved it with this rule:

    <rule name="from-xyz-to-bar" stopProcessing="true">
        <match url=".*" />
        <conditions logicalGrouping="MatchAny">
            <add input="{HTTP_HOST}" pattern="^xyz\.it$" />
        </conditions>
        <action type="Redirect" url="http://bar.it/foo" appendQueryString="false" redirectType="Permanent" />
    </rule>

But it doesn't work. What my rule is doing is redirecting http://xyz.it/page1 to http://bar.it/page1 and I don't understand where I am wrong.

Please help!

Upvotes: 6

Views: 767

Answers (1)

davidcondrey
davidcondrey

Reputation: 35993

<rule name="from-xyz-to-bar" stopProcessing="true">
    <match url="^$" />
    <action type="Redirect" url="http://bar.it/foo" />
</rule>

Upvotes: 2

Related Questions