Force HTTPS for your site
Your free SSL certificate lets visitors use https://, but nothing makes them. Forcing HTTPS redirects every http:// request to the secure address. Browsers also stop showing "Not secure".
Before you start
- Confirm
https://example.caloads without a warning. If not, see Why your free SSL hasn't been issued. - Back up
.htaccess. See .htaccess basics.
Option 1: Ask us
Open a request at https://barbrick.ca/submitticket.php and we'll turn it on for you, usually the same day.
Option 2: .htaccess
Open public_html/.htaccess in Files and add this near the top:
# Force HTTPS for every request
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
To combine HTTPS with a preferred hostname in one hop, see www or no www.
WordPress
- Change the WordPress Address and Site Address to
https://in Settings → General, or see Change a WordPress site's URL. - Add the rule above.
- Fix mixed content (below).
Mixed content
If the padlock shows a warning, the page loads some images or scripts over http://. Open your browser's developer console to find them, and change the links to https://. In WordPress, run a dry run first:
wp search-replace 'http://example.ca' 'https://example.ca' --dry-run
If something goes wrong
- Redirect loop: a CDN or proxy handles HTTPS itself. Remove the rule or use the
X-Forwarded-Protoheader check your provider documents. - Some pages still insecure: hard-coded
http://links in the content or theme. - Email links broke: they didn't. Email isn't affected by site HTTPS.
Still stuck? Ask us and we'll walk you through it.