http请求应该重定向到https

http request should be redirect to https

我已经在我的服务器上安装了 SSL。
所以请求默认是https.

我想解决我的第一个案子。

您没有显示您的 .htaccess 文件中的内容,但我使用以下内容将所有标准 http 流量重定向到 https。

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{SERVER_NAME}/ [R,L]

如果您使用 Magento

,您需要在 .htaccess 文件顶部添加以下代码
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Options +FollowSymLinks
RewriteEngine on

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]