I have an linux package via 123-reg, hosting a standard Wordpress site. I have an SSL certificate installed and setup.
To get Wordpress working on HTTPS, i updated the site and home URL via wp-config, as I normally do, however this wasn't working and causing infinite redirect loops. No idea why.
So I added $_SERVER['HTTPS']='on';
in wp-config (found a suggested post), and it then loaded fine on https. No idea why this works?
I then wanted to force redirect http to https, so in htaccess i added:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
This does force it to https, but then a infinite redirect loop occurs, redirecting to itself!
I've done a search and replace on the database to replace any mentions of http to https.
Any advice please? Thank you.
Edit: I'm not asking for htaccess rules to force https as noted in a duplicate question request. The rule I have works, the issue is specifically that when I force https, I get a infinite redirect loop.