title: 301 redirect in Azure ASP.Net Core website
body: <p>Google is getting confused about which page to index, even though it is all nicely explained in the sitemap. </p>
  
  <p>I created a redirect rule in web.config to redirect traffic from naked to www and this works great</p>
  
  <pre><code> &lt;rule name="Redirect to www" patternSyntax="Wildcard" stopProcessing="true"&gt;
          &lt;match url="*" /&gt;
          &lt;conditions&gt;
            &lt;add input="{HTTP_HOST}" pattern="example.com" /&gt;
          &lt;/conditions&gt;
          &lt;action type="Redirect" url="https://www.example.com/{R:0}" redirectType="Permanent" /&gt;
        &lt;/rule&gt;
  </code></pre>
  
  <p>I am trying to create a second rule to redirect domain/home/index and domain/index to root but am not able to. Below doesn't work. I tried a few variations with different regex in pattern fields, but nothing is working. </p>
  
  <pre><code>    &lt;rule name="Redirect index" patternSyntax="Wildcard" stopProcessing="true"&gt;
        &lt;match url="*" /&gt;
        &lt;conditions&gt;
          &lt;add input="{HTTP_HOST}" pattern="example.com/home/index" /&gt;
        &lt;/conditions&gt;
        &lt;action type="Redirect" url="https://www.example.com/" redirectType="Permanent" /&gt;
      &lt;/rule&gt;
  </code></pre>