WordPress Redirecting too many time after enable SSL

Sometime we have to change our wordpress website URL. but always it’s not work as we respect. From yesterday I’m facing the same issue.

I was trying to add SSL with my website but it’s not working anymore. I was getting this below error from broser.

WP Redirect issue

But finally i solve it by add this below code to wp_config.php file below “/* Add any custom values between this line and the “stop editing” line. */” this comment.

if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){
    $_SERVER['HTTPS'] = 'on';
}