http请求应该重定向到https
http request should be redirect to https
我已经在我的服务器上安装了 SSL。
所以请求默认是https
.
- 但是当我输入 Url
http://example.com/abc/a
它重定向到
https://example.com
应该转到 (https://example.com/abc/a
)。
- 当我尝试使用完全安全的 Url
https://example.com/abc/a
时
重定向到相同的。
我想解决我的第一个案子。
您没有显示您的 .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]
我已经在我的服务器上安装了 SSL。
所以请求默认是https
.
- 但是当我输入 Url
http://example.com/abc/a
它重定向到https://example.com
应该转到 (https://example.com/abc/a
)。 - 当我尝试使用完全安全的 Url
https://example.com/abc/a
时 重定向到相同的。
我想解决我的第一个案子。
您没有显示您的 .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]