Set up Cloudflare SSL if origin server doesn't support SSL


#1

Hello,
I have bought a Cpanel Shared Hosting that doesn’t have any SSL support nor any option to add custom SSL. So I need to use Cloudflare SSL.
I have enabled the following.

  1. Cloudflare Flexible SSL.
  2. Always Use HTTPS.
  3. Opportunistic Encryption
  4. Automatic HTTPS Rewrites.

Now Do I need to write htaccess rule for redirecting http to https?
and do I need to change http to https from Setting > General> Wordpress Address/Site Address ?

Please mention if I have missed anything.
Thanks.


#2

Step 1. Add this code in the wp-config.php

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';

Source & More information https://codex.wordpress.org/Administration_Over_SSL#Using_a_Reverse_Proxy

  1. Install, Activate Really Simple SSL

  2. Go to settings enable it

Rest you are good to go


#3

I have added the line in the beginning of wp-config.php. No problem so far. Thanks.