title: IIS Web.config rewrite rule issue
body: <p>I recently moved my website from http to https
  My SSL certificate is for www.domain.com and not for domain.com, i.e. with www as prefix.</p>
  
  <p>Now I facing an issue, when someone is accessing my website as <a href="http://www.domain.com" rel="nofollow">http://www.domain.com</a> it redirect to htts://www.domain.com without any issue as I have mentioned permanent redirect in web.config rewrite rules using following rules</p>
  
  <pre><code>&lt;rewrite&gt;
  &lt;rules&gt;
  &lt;rule name="HTTP to HTTPS redirect" stopProcessing="true"&gt; 
  &lt;match url="(.*)" /&gt; 
  &lt;conditions logicalGrouping="MatchAll"&gt;
          &lt;add input="{HTTPS}" pattern="off" ignoreCase="true" /&gt;
          &lt;add input="{REQUEST_URI}" negate="true" pattern="^/mobile.asmx*" ignoreCase="true" /&gt;
  &lt;/conditions&gt; 
  &lt;action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" /&gt;
  &lt;/rule&gt;   
    &lt;/rules&gt;
  &lt;/rewrite&gt;
  </code></pre>
  
  <p>However, when some is trying <a href="http://domain.com" rel="nofollow">http://domain.com</a> I am getting certificate error as SSL certificate is for domain with www prefix.</p>
  
  <p>What I need help with is that rewrite should work as follows:
  if request is from <a href="http://www.domain.com" rel="nofollow">http://www.domain.com</a> then move it to <a href="https://www.domain.com" rel="nofollow">https://www.domain.com</a>
  however, if request is from <a href="http://domain.com" rel="nofollow">http://domain.com</a> then also move it to <a href="https://www.domain.com" rel="nofollow">https://www.domain.com</a>.</p>
  
  <p>Please help if possible as the issue is with live website.</p>