最近幫一個顧客做網站, 需要HTTPS.
之前接觸的SSL certificate直接上傳到plesk 上面勾選重定向即可.
在此先吐槽下godaddy 服務貴功能還少.
用代碼從HTTP來重定向到HTTPS 代碼如下
<system.webServer>
<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="Permanent" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
只需要把以上代碼放到web.config 里面的<configuration>里面即可代碼重定向到HTTPS.
