Whilst recently converting a WordPress site from http to https I hit a problem where no matter what I did, the site would result in a redirect loop causing the page to fail.

The website in question was fronted by Cloud Flare CDN.

Turns out there’s a quick solution!   Add the following code snippet to your wp.config file:


if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)