Key takeaways
- Use one permanent redirect from HTTP to HTTPS.
- Behind a CDN, redirect at the CDN to avoid loops.
- Roll out HSTS with a short max-age first.
Once your site has an SSL certificate, send every visitor to the secure version with a single permanent redirect.
Option 1: cPanel
Open Domains, find the domain and switch on Force HTTPS Redirect. The toggle is only available when the domain has a valid certificate.
Option 2: .htaccess
Add this near the top of .htaccess in the document root:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
To also standardise on the bare domain in one hop:
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
WordPress
Also update Settings → General so both addresses start with https://, then fix any mixed content.
Add HSTS (optional)
HTTP Strict Transport Security tells browsers to always use HTTPS for your domain:
Header always set Strict-Transport-Security "max-age=31536000"
Start with a short max-age (such as 300) to test, and only add includeSubDomains once every subdomain supports HTTPS.