Have you checked if your website is accessible through both
Because if your website is accessible through the both www and non-www, this might grow into a serious SEO problem over time.
But… you can quickly resolve this by using Cloudflare’s Page Rules option. Please note that this will only work if your website is added to Cloudflare.
Here’s how to do it:
Cloudflare www to non-www redirect
#1 – Open Page Rules in Cloudflare
First of all, log into your Cloudflare dashboard and select the website that you want to add the 301 redirect for.
Now, go to the Rules section and click on the Create Page Rule button as shown in the screenshot below:
#2 – Add 301 redirect rules
Now, it’s time to add the actual 301 redirect rules that will send all your www traffic to the non-www (or, naked) version of your website.
www.yoursite.com/*in the first field
- Select Forwarding URL in the first dropdown field
- Select 301 – Permanent Redirect in the second dropdown field, and
https://yoursite.com/$1in the last field
If your website is http then use http instead of https in the 4th step above.
That’s it, all the www requests should now be redirected to the non-www version within a minute.
Please note that the page rules only work if you have Proxy Status turned on for
CNAMErecords in the Cloudflare DNS section.
If you’re stuck somewhere, please let me know by dropping a quick comment below.