You can use the “enhanced text widget” plugin to add a code in any sidebar that lets you properly redirect the browser to the secure version of your site (https), because do the way you do, generates precisely that loop which you are suffering. The code is shown below:
<?php
functiontosendhttps();
function functiontosendhttps(){
?><script type="text/javascript">
if(location.href.indexOf('https:')==-1) location.href=location.href.replace('http:','https:');
</script><?php
}
?>
If you use your own plugin to add code to WP, you can use the following code (which in fact is the correct way to do it)
add_action('wp_head','functiontosendhttps',1);
function functiontosendhttps(){
?><script type="text/javascript">
if(location.href.indexOf('https:')==-1) location.href=location.href.replace('http:','https:');
</script><?php
}
To solve the redirection loop, you can run the following SQL query on the database that manages your WP installation
I tried to put the code as is, however, the site modifies it, preventing it from place properly, so I put it in Base64, to see it properly, simply drag it to the address bar or a new tab.
data:text/plain;base64,VVBEQVRFIGBwcmVmaXhfb3B0aW9uc2AgU0VUDQpgb3B0aW9uX3ZhbHVlYCA9ICdodHRwOi8vd3d3LmZveGFuZGhhcmUubmV0Jw0KV0hFUkUgKChgb3B0aW9uX25hbWVgID0gJ3NpdGV1cmwnKSBPUiAoYG9wdGlvbl9uYW1lYCA9ICdob21lJykpOw==
In this example, the installation prefix is “prefix_” and obviously you must change it according to your installation.
I hope it works for you, greetings