WordPress allows you to enforce SSL / HTTPS for the admin area by entering the following line into your wp-config.php file.

define('FORCE_SSL_ADMIN', true);

However, in some scenarios this setting alone would cause ‘Too many redirects‘ error. To fix this, you will need to add the following code to your wp-config.php file just before the line that says ‘That’s all, stop editing! Happy blogging.’.

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

Issue fixed.

Was this answer helpful? 321 Users Found This Useful (356 Votes)