Docgyan
Docgyan

Reputation: 685

how to configure redirect rule in Azure webapp under web.config

I am trying to redirect the request which comes to Https://www.example.ie to Https://www.example.com/ab-ng. Below is the rule which I have in my web.config but not working as expected.

<rule name="Redirect to ab-ng" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^Https://www.example.ie$" />
          </conditions>
          <action type="Redirect" url="https://www.example.com/ab-ng/{R:0}" redirectType="Permanent" />

I am new to redirect rules, please help.

Upvotes: 1

Views: 3283

Answers (1)

Sairam Tadepalli
Sairam Tadepalli

Reputation: 1683

  • Change the url in action type="Redirect".Remove Https . It has to be
<action type="Redirect" url="https://www.example.com/ab-ng/{R:0}" redirectType="Permanent" />  
  • Check whether the web.config file is deployed properly, It has to be under wwwroot directory in KUDU Console.

  • In Azure portal,Make sure HTTPS Only is set to On under TLS/SSL settings.

enter image description here

Please refer Web.config redirects with rewrite rules for more information

Upvotes: 1

Related Questions