Background

Too many redirects” ONLY when trying to access wp-admin page

entry image

If you are wondering why admin panel of wordpress site gets turn off then it must be problem with https and http:

Put these code in wp-config.php at the top and will fix the issues:


if
($_SERVER['PHP_SELF']=="/index.php") { define('WP_HOME','https://yourdomain.com'); define('WP_SITEURL','https://yourdomain.com'); } else { define('WP_HOME','http://yourdomain.com'); define('WP_SITEURL','http://yourdomain.com'); }


# If error occuring, 500 error (Copy and paste below code in wp-config)

define('WP_HOME','https://shop.idevice.sg'); define('WP_SITEURL','https://shop.idevice.sg'); if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' == $_SERVER['HTTP_X_FORWARDED_PROTO'] ) { $_SERVER['HTTPS'] = 'on'; }