Fix Cloudflare SSL Errors on a WordPress Website
When your WordPress site shows SSL errors after enabling Cloudflare. This article explains how to fix Cloudflare SSL errors on WordPress.
You may have come across issues where a WordPress website using Cloudflare SSL shows the default page or the wp-admin shows 404 error. This error occurs if the SSL mode is set to "strict" on Cloudflare.
You can try adding the following code in the .htaccess file of the website.
SetEnvIf X-Forwarded-Proto https HTTPS
This should be the first line in the .htaccess file. You will also have to add the following lines of code in the wp-config.php file to force the website to use SSL.
define('FORCE_SSL_ADMIN', true);
// in some setups HTTP_X_FORWARDED_PROTO might contain
// a comma-separated list e.g. http,https
// so check for https existence
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';
The constant FORCE_SSL_ADMIN is set to true in the wp-config.php file to force all logins and all admin sessions to happen over SSL.
Further please also confirm that the site URL and home URL are correct i.e "https" is added.
Alternatively, the ideal fix for this problem would be to fetch the Cloudflare SSL certificate and Private Key and install the same in cpanel via SSL/TLS >> Manage SSL sites option.