你有一个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>
请看看编辑的问题。 –