sindrem
sindrem

Reputation: 1231

Web config - redirect specific url with domain to another url

I would like to redirect testdomain.com/diamonds/silver to testdomain.com/diamonds.

I need to have the domain specified because the website has several domains attached to it.

This is what i have now, but it does not seem to do anything.

<rule name="testredirect" stopProcessing="true">
        <match url=".*" />
         <conditions logicalGrouping="MatchAny">
           <add input="{HTTP_HOST}" pattern="^testdomain.com/diamonds/silver" />
         </conditions>
         <action type="Redirect" url="/diamonds" redirectType="Permanent" />
 </rule>

I have also tried this, but that did not work either.

<rule name="testredirect" stopProcessing="true">
    <match url="^testdomain.com/diamonds/silver" ignoreCase="true" />
    <action type="Redirect" url="/diamonds" redirectType="Permanent"/> 
</rule>

Any suggestions?

I have figured it out. Answer below!

Upvotes: 1

Views: 4281

Answers (1)

sindrem
sindrem

Reputation: 1231

Finally.

This worked:

<rule name="redirect diamonds" stopProcessing="true">
            <match url="^diamonds/diamondrings" ignoreCase="true" />
            <conditions>
                <add input="{HTTP_HOST}" pattern="^(www.)?mywebshop.azurewebsites.net" />
            </conditions>
            <action type="Redirect" url="/diamondrings" redirectType="Permanent" />
        </rule>

Upvotes: 4

Related Questions