I used Astro framework to deploy example.com to cloudflare pages. How do I add the www subdomain

I can access example.com through the browser but www.example.com does not work. I tried adding a CNAME.txt file to the root of the Astro project directory containing the following lines: ;; CNAME Records example.com. 1 IN CNAME example.pages.dev. blog.example.com. 1 IN CNAME example.com. www.example.com. 1 IN CNAME example.com. In cloudflare I have the following setup: "www.example.com is an alias of example.com and has its traffic proxied through Cloudflare." prettyscore.pages.dev Account id: 25f423fc3a33fbc5f80db1fe482f848c
No description
4 Replies
Chaika
Chaika13mo ago
You need to add www as a Custom Domain in your Pages project Settings (like you added the root domain) for it to work
Chaika
Chaika13mo ago
Alternatively a redirect is the better option for seo and not confusing people: https://developers.cloudflare.com/pages/how-to/www-redirect/
Redirecting www to domain apex · Cloudflare Pages docs
In this guide, you will learn how to redirect the www subdomain to your apex domain (example.com). This is a common question and can be achieved by …
Chaika
Chaika13mo ago
Same is true for blog, have to go to your Pages Project -> Custom Domains, and add blog.beautyscore.uk
nordicTravianGuy
nordicTravianGuyOP13mo ago
Thank you it worked! Yes redirect is what I wanted, sorry for the confusion.
Want results from more Discord servers?
Add your server