Cloudflare Root Domain Redirect to WWW

Background:

Redirect example.com to www.example.com (root/apex to www subdomain) using Single Redirects (also called Dynamic Redirects).

Prerequisites

Guide:

  1. Navigate to your website in Cloudflare, and then to DNS → Records. Magic link .

  2. Add a new record. The type should be AAAA (IPv6 type), the name should be @ (shorthand for your domain name), the IPv6 Address/value should be 100:: (IPv6 Discard, if nothing handles the traffic in Cloudflare, it won’t go anywhere), and Proxy Status should be on :orange:.

Make sure to click Save.
This will allow traffic to flow into Cloudflare and hit your Redirect. Cloudflare will serve its own Proxy IPs at edge, so both IPv4 and IPv6 Clients (everyone) will be able to connect.
3. Navigate to Rules → Redirects → Create Rule. Magic link

  1. Create your Redirect Rule. Give it a name, like Redirect root to www subdomain, and select Field: Hostname Operator: equals, Value: example.com.
    Under “Then… URL Redirect”, change Type to Dynamic and add the following expression concat("https://www.example.com", http.request.uri.path), check Preserve Query String. Replace any mention of example.com with your own domain.

Then click Deploy.
5. Wait a few minutes and test the redirect.

All steps and diagrams of zone records via the link below

https://community.cloudflare.com/t/redirect-example-com-to-www-example-com-using-single-dynamic-redirects/636762

Find and Post your Fav Software https://www.SoftwareHunt.io