Had recently worked on a WordPress site that needs requiring www and SSL on all their URL.
So, this looks easy to set up in Cloudflare and I had done this before but this has resulted in an infinite loop.
So I started searching over Google and find tons of fix, that I did try and failed. It’s so frustrating because we did this number of times and is working with non-Wordpress sites.
But after numerous testing, all we need to do to make this work is:
1. Update domain in WordPress’ dashboard->settings to contain www.
2. Second, create a page rule in Cloudflare that sets all URL force SSL.
you’ll see “/*” right after the domain, its a wildcard, this denotes all other subpages e.g. (/about-us, /contacts, /products), to make sure all URLs will force SSL.
Currently, this works fine on WordPress 5, let me know if you have a better solution 🙂