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
# END WordPress

The problem is only with the homepage. Nothing else.

What am I missing?


  • 2
    Hi. I am not sure about the exact scenario whether the site in picture is behind load balancer or not. But I think the 'Notes' section on this Codex documentation page may be helpful, so please take a look. Oct 14, 2015 at 5:38
  • Thanks so much @ItsMePN for pointing to correct info. Yes, the site is behind Cloudflare. & the problem is now resolved. Cheers
    – tushonline
    Oct 14, 2015 at 9:33

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.