你有一個SSL您的託管購買的?如果你有,你可以只安裝和配置的服務器上,然後在網站的根目錄下面的代碼添加一個htaccess: 對於基於Linux主機: 的htaccess:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
的Windows &的Plesk : 在您的網絡中使用以下代碼。配置文件會自動重定向訪問者到你的網站的HTTPS版本:
<configuration><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="Found" url="https://{HTTP_HOST}/{R:1}" /></rule> </rules></rewrite></system.webServer></configuration>
請看看編輯的問題。 –