WP-Admin Redirect Loop With CloudFlare Free SSL

Recently I installed CloudFlare’s Free SSL onto my site, and changed my site URL to https:// through the WordPress settings. All of the sudden, everytime I tried to go to /wp-admin, it would die in a redirect loop. There are a bunch of plugins out there that offer functionality that they say fix this, but I don’t want a bunch of plugins that run extra code and run event on the frontend slowing my site down. You simply have to add 4 lines of code to your wp-config.php file to fix the wp-admin redirect loop error with CloudFlare Free SSL.

File: /wp-config.php
Place Code On: Anything line above the wp-settings.php require_once

define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_LOGIN', true);
if( isset($_SERVER['HTTP_CF_VISITOR']) && strpos($_SERVER['HTTP_CF_VISITOR'], 'https') )

Conclusion: Once this code is in place, you should be able to login to wp-admin with your site URL set as https:// and not get a redirect loop error.



  1. Reply

  2. By Earle


Leave a Reply

Your email address will not be published. Required fields are marked *