Tuesday, May 21, 2019

How to redirect from HTTP to HTTPS in a web.config in CrownPeak CMS


<rewrite>
  <rules>
  <%
  if (context.PublishingPackage.PackageName.Contains("Live")
    {
    %>
    <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>
    <%
  }
  %>
  </rules>
</rewrite>

No comments:

Post a Comment