Website went blank when transferring from non www to www

You need a DNS registrar that can do a DNS redirect from the apex domain example.com to a subdomain www.example.com

It has different names, FWD record, “web forward” etc but it is best handled by your DNS provider.

https://community.cloudflare.com/t/root-domain-redirect-to-www/18265