2

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

  • 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. – Prasad Nevase Oct 14 '15 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 '15 at 9:33
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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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