title: IIS https non-www redirect to https www
body: <p>My IIS server does not redirect when using https with non-www. What I would like to achieve is to redirect <a href="https://xyzdomain.com" rel="nofollow noreferrer">https://xyzdomain.com</a> to <a href="https://www.xyzdomain.com" rel="nofollow noreferrer">https://www.xyzdomain.com</a>.</p>
  <p><a href="http://xyzdomain.com" rel="nofollow noreferrer">http://xyzdomain.com</a> and **<a href="http://www.xyzdomain.com" rel="nofollow noreferrer">http://www.xyzdomain.com</a> are redirected correctly to <a href="https://www.xyzdomain.com" rel="nofollow noreferrer">https://www.xyzdomain.com</a>.</p>
  <p>For the moment the code looks as follows:</p>
  <pre><code>&lt;rewrite&gt;
          &lt;rules&gt;
              &lt;clear /&gt;
              &lt;rule name=&quot;CanonicalHostNameRule&quot; enabled=&quot;true&quot; stopProcessing=&quot;true&quot;&gt;
                  &lt;match url=&quot;(.*)&quot; /&gt;
                  &lt;conditions logicalGrouping=&quot;MatchAll&quot; trackAllCaptures=&quot;false&quot;&gt;
                      &lt;add input=&quot;{HTTP_HOST}&quot; pattern=&quot;^www\.xyzdomain\.ro$&quot; negate=&quot;true&quot; /&gt;
                  &lt;/conditions&gt;
                  &lt;action type=&quot;Redirect&quot; url=&quot;https://www.xyzdomain.ro/{R:1}&quot; appendQueryString=&quot;true&quot; /&gt;
              &lt;/rule&gt;
              &lt;rule name=&quot;HTTP to HTTPS&quot; enabled=&quot;true&quot; stopProcessing=&quot;true&quot;&gt;
                  &lt;match url=&quot;(.*)&quot; /&gt;
                  &lt;conditions logicalGrouping=&quot;MatchAll&quot; trackAllCaptures=&quot;false&quot;&gt;
                      &lt;add input=&quot;{HTTPS}&quot; pattern=&quot;^OFF$&quot; /&gt;
                  &lt;/conditions&gt;
                  &lt;action type=&quot;Redirect&quot; url=&quot;https://{HTTP_HOST}{REQUEST_URI}&quot; appendQueryString=&quot;false&quot; redirectType=&quot;Permanent&quot; /&gt;
              &lt;/rule&gt;
          &lt;/rules&gt;
      &lt;/rewrite&gt;
  </code></pre>
  <p>Thank you in advance,
  TrQ</p>