sksanthosh17

Registered
Oct 23, 2018
1
0
1
Chennai
cPanel Access Level
Root Administrator
We are trying to redirect "webmail.domain.com" from http to https in .htaccess file, but we couldn't get redirected.

RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

This only works for main domain "domain.com"

We need both Primary and all subdomains to be redirected to https

Kindly suggest a rule to get redirected

Thanks in advance:)
 

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
7,940
630
263
Houston
cPanel Access Level
DataCenter Provider
Hi @sksanthosh17


Proxy subdomains are a bit different than normal subdomains. You can force SSL by going to WHM>>Server Configuration>>Tweak Settings -> and enable:

Require SSL for cPanel Services
This option forces the server to redirect unencrypted cPanel, Webmail, WHM, and DAV requests to secure ports according to the SSL redirection settings. If “Choose the closest matched domain for which that the system has a valid certificate when redirecting from non-SSL to SSL URLs” is enabled, the system will redirect to the best-matched certificate for the domain. If “Choose the closest matched domain for which that the system has a valid certificate when redirecting from non-SSL to SSL URLs” is disabled, the system will redirect to the https:// URL for the domain, even if no valid certificate exists for the domain.

Thanks!