WordPress with Cloudflare redirect issue.

If the hosting server has invalid or expired SSL and SSL is set to flexible/full in cloudflare, it is going to cause a redirect loop. The fix is to add below code in wp-config.php file. $_SERVER[‘HTTPS’] = ‘on’;