
This tutorial will show you how to redirect all traffic from your www domain to your non-www domain using a Cloudflare rule. You can set this rule with a free account (up to 3 rules). To redirect your traffic, and therefore optimize the SEO as well as the display speed of your website, you just have to follow these 2 steps: add a Cloudflare rule, then add a DNS record.
I Adding a rule
1. In your Cloudflare account, select your website.



– In the first field just above the mention “if the URL matches”, enter the URL of your current website with the www, such as: www.mydomain.com/*. The asterisk will allow us to match the routes in the destination URL.

– Select “Forwarding URL” and “301 – Permanent Redirection”.
– Destination URL: enter the URL of your website without the www, such as: https://mydomain.com/$1. The asterisk combined with the “$1” will match and retain all routes.
II Adding a DNS record


In the “Type” field: choose “A”.
In the “Name” field, type “www”.
In the “Ipv4” field: enter your IP address (the same as the other DNS records).

Recap in this video from the Cloudflare community:
Other SEO and Optimization articles.
