28 Şubat 2019 Perşembe

Http To Https Force WWW Cname

Merhabalar,  IIS üzerinde manuel olarak oluşturulan asp.net web uygulamalarında genelde domain blank şekilde ilerlemektedir.

www.domainaddress.com adresine istersek domainaddress.com olarak da erişebiliriz, protokol değişikliği de ihtiyaç olabilir. Http üzerinden Https iletimi de zorunlu olarak istenebilir.

Bu işlemler için WebConfig dosyası üzerinde 
<configuration>  altındaki  <system.webServer>  nodu içerisinde rewrite uygulamak gerekecektir.

 <system.webServer>
<rewrite>
  <rules>
    <rule name="Redirect to www" stopProcessing="true">
      <match url="(.*)" />
      <conditions trackAllCaptures="false">
        <add input="{HTTP_HOST}" pattern="^domainaddress.com$" />
      </conditions>
      <action type="Redirect"
        url="{MapProtocol:{HTTPS}}://www.domainaddress.com/{R:1}" />
    </rule>
  </rules>
  <rewriteMaps>
    <rewriteMap name="MapProtocol">
      <add key="on" value="https" />
      <add key="off" value="http" />
    </rewriteMap>
  </rewriteMaps>
</rewrite>
</system.webServer>

Sevgilerle.