title: Issues with https:// non-www re-directing to https://www
body: <p>I have a website which has recently moved from http:// to https:// </p>
  
  <p>The site is built with MVC hosted on IIS7, and I know I should have 4 bindings in place for this.</p>
  
  <p>the main one:<br>
          <a href="https://www.example.com" rel="nofollow noreferrer">https://www.example.com</a> (port:443 - ip address: *)</p>
  
  <p>and 3 others all to 301 re-direct to the above.</p>
  
  <pre><code>    http://www.example.com - (port:80 - ip address: * -re-direct works)
      http://example.com - (port:80 - ip address: * -re-direct works)
      https://example.com - (port:443 - ip address: * -re-direct does not work)
  </code></pre>
  
  <p>Trying to troubleshoot why the bottom one is failing with Site could not be reached. server DNS address could not be found.</p>
  
  <p>Below is the code I am using to re-direct http to https</p>
  
  <pre><code>            // The base only redirects GET, but we added HEAD as well. This avoids exceptions for bots crawling using HEAD.
              // The other requests will throw an exception to ensure the correct verbs are used. 
              // We fall back to the base method as the mvc exceptions are marked as internal. 
  
              if (!String.Equals(filterContext.HttpContext.Request.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase)
                  &amp;&amp; !String.Equals(filterContext.HttpContext.Request.HttpMethod, "HEAD", StringComparison.OrdinalIgnoreCase))
              {
                  base.HandleNonHttpsRequest(filterContext);
              }
  
              // Redirect to HTTPS version of page
              // We updated this to redirect using 301 (permanent) instead of 302 (temporary).
              string url = "https://" + filterContext.HttpContext.Request.Url.Host + filterContext.HttpContext.Request.RawUrl;
  
              filterContext.Result = new RedirectResult(url, true);
  </code></pre>
  
  <p>Any ideas what is going wrong here with the bottom binding? Trying to set up 4th property on Google Webmaster Search Console and obviously can't due to failing DNS. </p>
  
  <p>Any help at all is greatly appreciated. Cheers</p>