You can easily redirect a www subdomain with Cloudflare (like redirecting
First, we’ll create a dummy record in Cloudflare for the
www subdomain, so that Cloudflare can control it.
A record for the
www subdomain of your domain, with the IP address
192.0.2.1. This IP address doesn’t actually matter; what matters is that Proxied is turned on. This way, Cloudflare sits in front of your
www subdomain, and we can redirect it using Cloudflare.
Next, go to Page Rules for your domain in Cloudflare’s settings.
Create a rule for your
www subdomain (for example, if my domain was
example.com, I’d do
www.example.com). Set the settings to “Forwarding URL” with a 301 redirect to
https://example.com/$1 (again, replace
example.com with your domain).
Save this page rule. Now, your
www subdomain will redirect to the corresponding page on your non-www (“naked”) domain!