Managed technical services across Canada
Proudly Canadian

Guide

HTTPS Redirect Configuration on Canadian Hosting: A Complete Guide

Setting up correct HTTPS redirects on Canadian hosting prevents mixed content warnings, redirect loops, and SEO issues. This guide covers configuring redirects in .htaccess for Apache, in Nginx server blocks, and through cPanel and Webuzo, with specific fixes for Cloudflare setups.

Editorial process: This article was created with AI assistance and prepared for publication by Gotekky.

Quick answer

What to check first

Setting up correct HTTPS redirects on Canadian hosting prevents mixed content warnings, redirect loops, and SEO issues. This guide covers configuring redirects in .htaccess for Apache, in Nginx server blocks, and through cPanel and Webuzo, with specific fixes for Cloudflare setups.

Forcing all traffic to HTTPS creates a disproportionate share of support requests on Canadian hosting accounts. Redirect loops, mixed content warnings, and broken functionality after adding the redirect are common enough that understanding the correct approach for your specific configuration saves significant frustration.

The correct .htaccess redirect for Apache on Canadian cPanel hosting

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

The condition checks whether the current connection is not already HTTPS. If not, the rule redirects to the HTTPS version of the same URL. The 301 status code tells browsers and search engines this is permanent. Using 302 for HTTPS redirects is a mistake that prevents browsers from caching the redirect and causes every HTTP request to do a round trip.

When Cloudflare is in front of your Canadian server

The most common cause of HTTPS redirect loops on Canadian hosting is a conflict between Cloudflare's SSL setting and the server's redirect configuration. When Cloudflare is set to Flexible SSL mode, it connects to your origin server over plain HTTP. If your .htaccess also redirects HTTP to HTTPS, the request hits the server over HTTP from Cloudflare, gets redirected to HTTPS, comes back to Cloudflare over HTTPS, which then connects to the origin over HTTP again, causing a loop. Fix: set Cloudflare's SSL mode to Full or Full (Strict). Alternatively, use the X-Forwarded-Proto header Cloudflare sends:

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

HTTPS redirect in Nginx on a Canadian VPS

server {
    listen 80;
    server_name yourdomain.ca www.yourdomain.ca;
    return 301 https://$host$request_uri;
}

The redirect at the Nginx level is processed before PHP or application code runs, making it the most efficient approach.

WordPress-specific HTTPS configuration

After setting up the server-level redirect, verify WordPress's URL settings use HTTPS in Settings, General. For a site previously on HTTP, run a database search-replace to update all hardcoded HTTP URLs in post content, custom fields, and options:

wp search-replace 'http://yourdomain.ca' 'https://yourdomain.ca' --all-tables

This resolves persistent mixed content warnings after adding SSL to a previously HTTP site.

Gotekky

Need help deciding what to do next?

Tell us what you are seeing and what outcome you need. We will identify whether a managed service, scoped project or paid technical assessment is the right next step.