You are using a custom domain on your Cloudflare Pages and you are looking for a way to redirect the traffic coming to your www subdomain to your non-www URL? You are at the right place!
Official documentation
The first thing I did was to look into the official documentation to look for an article describing how to achieve my goal. Sure you did too 😉.
Recommended: Bulk Redirect List and Rule
I’ve found that article! I thought that would be it and straightforward but… unfortunately nah 🙄.
I can’t get my www.jonathandionne.com to redirect to jonathandionne.com and strangly I’m having success with any other subdomains I’m using but can’t get it to work for www 🤔.
Workaround: Page Rules
After some googling, I’ve found that answer (thanks cloonan) that suggest using Page Rules to achieve that goal.
- Visit the Cloudflare dashboard and select your domain.
- Click on the
Page Rulestab. - Click on
Create Page Rule. - In the
If the URL matchesfield, input www.yourdomain.com/*. - Select
Forwarding URLand choose a301 (Permanent Redirect)status. - In the
Enter destination URLfield, input https://yourdomain.com/$1. - Click
Save and Deployto create the rule.
Here’s an example of what I’ve done for my blog.

The missing part
In a desperate attempt, I decided to try to add another custom domain on my Cloudflare Page, but this time I would add it with the www subdomain.
I follow along with the next steps required to complete the setup and update my DNS settings with that new CNAME entry.
The last thing to do was to use one of the two methods described previously I chose the recommended one with Bulk Redirect List and Rule.
It worked! All traffic coming to my www subdomain is now redirected to my non-www domain 🎉.