Configuire blogengine.net for https

Topics: Controls
Nov 19, 2015 at 11:24 PM
Edited Nov 19, 2015 at 11:26 PM
Is there a specific way of setting up blogengine.net to use https prefix? I tried using the following in the web.config file but it didn't work:
  <rewrite>
    <rules>
      <rule name="HTTP to HTTPS redirect" stopProcessing="true"> <match url="(.*)" />
  <conditions>
    <add input="{HTTPS}" pattern="off" ignoreCase="true" />
  </conditions>
  <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>       
    </rules>
  </rewrite>
Also looking at having to redirect all img, links, etc. from http to https. If anybody has an idea I would greatly appreciate the input.
Nov 20, 2015 at 3:50 PM
This is what I'm using on my blog. I have two rules. The first is to redirect to HTTPS, and the second is to remove "www" from the URL. It looks almost exactly like your code... mine works on my site though). Can you browse your site using HTTPS by manually updating the URL to HTTPS?

I'd try to avoid using absolute paths in your URLs... switch to using relative paths, or you can create a path without proving a protocol. So, for example, instead of creating a link to "http://mydomain.com/image.png", you could so something like "/image.png" or "//mydomain.com/image.png". From what I remember, there were only a few places I where I had to update a link, and those may have already been fixed by the BlogEngine team.
<rewrite>
      <rules>
        <rule name="Redirect to https" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
        </rule>
        <rule name="Redirect www sub-domain to domain" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^www\.bloodforge\.com$" />
          </conditions>
          <action type="Redirect" url="http://bloodforge.com/{R:1}" redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>