将cpanel的http重定向到https

问题描述 投票:0回答:2

我想将http://cpanel.domain.com重定向到https://cpanel.domain.com我该怎么办?

我尝试了这个,但它不适用于cPanel,仅适用于domain.com:

RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
.htaccess cpanel
2个回答
0
投票

下面的代码是将HTTP重定向到HTTPS所需要的。

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

0
投票

将此代码添加到.htaccess文件中RewriteEngine开RewriteCond%{SERVER_PORT} 80RewriteRule ^(。*)$https://www.yourdomain.com/$ 1 [R,L]

© www.soinside.com 2019 - 2024. All rights reserved.