How to have www.example.com redirect to example.com
So far I have tried many methods like having the www CNAME point to the non-www route or having the www CNAME point to the pages. I also tried using dynamic redirects for both but keep getting DNS errors
My ideal world would be when a user navigates to
www.snipermarketing.co/contact--->snipermarketing.co
Is there a work around or something because I heard that having the smae content on two different domains negatively affects seo aslo I want have a single url of truth for www and non-www which is why I want the naked domain to be it
2 Replies
site -> rules -> redirect rules -> create
hostname equals www.yourdomain.com
then
dynamic concat("https://yourdomain.com", http.request.uri.path) status code 301
deploy
I tried that but it failed as it said url not found it works for the naked route
I have it on cloudflare Pages with both www and non www have a dns alias to sniper-marketing.pages.dev