Attach Cloudflare pages to a subdomain

Initial situation:
3 domains with an external hoster

I have created a CF page to which I wanted to move today. I changed the nameservers (as described) at the old provider.
The access to the domain (example.com) works in principle, but the access to www.example.com does not.

I have the following entries at the DNS:
TYPE | NAME | CONTENT
CNAME | example.io | example.pages.dev
CNAME | www | example.pages.dev
MX | example.com | 50 [old mailserver at old hoster]
MX | example.com | 10 [old mailserver2 at old hoster]
TXT | example.com | “v=spf1 mx a include:_spf.webhosting.systems ~all”
The TXT entry is still from the old provider.
Proxy is enabled at the CNAMEs.

Can someone please help me to identify the error, why does https://example.com work but not https://www.example.com (should also show the same page)?
I have already tried to search, but unfortunately I did not get any further.
Thanks in advance for any help!
Best regards
Michael

1 Like

What specific error do you get? Is it a 522?

Each domain/subdomain (hostname) must be added to the Pages Project as another custom domain, this includes any subdomains like www (You have to have both example.com and www.example.com as two separate custom domains in your Pages Project), if you haven’t already added it: Custom domains · Cloudflare Pages docs

That being said, it is bad for SEO/Search engines if you have duplicate content, as such it is usually recommended you just deploy a redirect instead: Redirecting www to domain apex · Cloudflare Pages docs

2 Likes

Thanks a lot, with the tip (bulk redirects) I was able to solve it.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.