How to force HTTPS for the entire site
Forcing HTTPS means that every attempt to open the site over http is redirected to the secure version, and the browser stops trying http after that. It has two parts: a redirect and the HSTS header. Without them, an unsecured copy of the site stays reachable next to the secure one, and search engines see duplicate URLs.
Check your site
-
Check that the certificate covers every hostname
Before forcing HTTPS, check in cPanel under SSL/TLS Status that the certificate is valid for the bare domain, for www and for every subdomain you use. Otherwise the redirect sends visitors to a hostname without a certificate, and they get an error.
-
Turn on the redirect to https
Add a rule to .htaccess with RewriteCond %{HTTPS} off and a RewriteRule to the https version of the same URL with [R=301,L]. In WordPress, set the https address in Settings > General first, or you end up with a redirect loop.
-
Redirect to one canonical host
Pick one main version, with or without www, and point everything at it. A single redirect from http straight to https on the canonical host is enough; avoid chains of two or three hops.
-
Add the HSTS header
In .htaccess, add Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains". The header tells the browser to use only https for at least a year, even if someone types http by hand.
-
Use includeSubDomains deliberately
The includeSubDomains directive extends the rule to every subdomain. Add it only if each subdomain has a working certificate, or those subdomains become unreachable.
-
Update internal links and clear the cache
Replace http links in your content with https (Better Search Replace or WP-CLI), then purge the page cache, LiteSpeed Cache and the CDN cache, so that visitors go straight to https without extra redirects.
How to verify the result
Type the address with http and try a few subdomains: everything should lead to https without warnings. Then check the certificate with the SpoofLens SSL checker and the HSTS header with the security headers checker to confirm that HTTPS is forced.
Tip: Do not set a large HSTS max-age until you are sure https works reliably: browsers remember the rule, and you cannot roll it back quickly.