我想将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}
答案 0 :(得分:0)
下面的代码是将HTTP
重定向到HTTPS
所需要的。
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
答案 1 :(得分:0)
将此代码添加到.htaccess文件中
RewriteEngine开启
RewriteCond%{SERVER_PORT} 80
RewriteRule ^(。*)$ https://www.yourdomain.com/ $ 1 [R,L]