Fix Too Many Redirects Errors on WordPress After Moving to SSL / HTTPS

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.

  • WordPress, SSL
  • 321 Users Found This Useful
Was this answer helpful?

Related Articles

Force HTTP to HTTPS Redirect with htaccess file

To set up HTTP to HTTPS redirect, you need to add the following code to your .htaccess file....

Public IP SSL Files for Apache, Nginx and IIS

The key is always the same for Apache, Nginx and IIS. It's the one you got at the very first when...