WP site URL changed to have HTTPS but still homepage does not redirect

I’ve changed the WP site URL to include https://www & it’s been a while. Entire site is correctly reflecting it.

enter image description here

But unless I add following in .htaccess, the home page does not redirect

RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

But, in case htaccess goes corrupt & gets regenerated, it skips this part.
Then http://domain.com does not redirect to http://wwww.domain.com

Even if that part was added within

# BEGIN WordPress
here
# END WordPress

The problem is only with the homepage. Nothing else.

What am I missing?

TIA

1 Answer
1

In case anyone runs into similar issues. Here is what worked, as suggested by ItsMePN.

If your site is on a loadbalancer such as CloudFlare, is_ssl() doesn’t work.

Neither did it work for me on a site hosted on “Cloudways + Digital Ocean”

Here is the gist https://gist.github.com/webaware/4688802 for force-ssl-url-scheme.php you need to download & upload it under wp-content/plugins & activate it.

Worked perfectly.

Leave a Comment