Www AND no-www - help

How can I make sure that if someone enters either www.mywebsite.com or mywebsite.com, they’ll land at my website? Right now they only get to me if they put the 3 www before our domain name.

Then just redirect the rootdomain (mywebsite.com) to the www.mywebsite.com, so everyone is landing at the www.mywebsite.com.
Redirects here normally are done with a PageRule.

But make sure that all DNS entries rootdomain and www exist.

1 Like

Fetch your website using a Cloudflare Worker - example code can be found here - and CNAME your @ (root, non-www) domain plus your www subdomain to the Worker URL. Please ask if you’d like more information.

1 Like

And just to elaborate what @M4rt1n said, best practice is to only have your site either with or without the www, but not both (and redirecting the one you don’t want to the one you do want). This is best for Search Engine Optimization, as using both will likely be seen negatively by most search engines, as it’s seen as having two identical sites for the same purpose, and could impact your ranking.

2 Likes

Whoa. This is different than what I was told elsewhere.
So maybe I should just leave it alone?

No please make sure that:

  1. All HTTP requests are redirected to HTTPS
  2. all requests to the rootdomain are redirected to the www subdomain, since you seems to use this one.

Then you are good to go.

3 Likes

You should pick one and redirect the other to it. There are workarounds with SEO and rankings if for some reason you want both, but it makes things more complicated to manage.

1 Like

I was under the impression that you wanted your site to function whether a user chooses the www subdomain or not & that you did not wish your users to notice an impact in their browsing relative to your domain. If so, if you fetch your site using a Worker, its simple. If you want to be compliant with current standards, then yes, listen to the other answers you’ve been given thus far.

Thank you. Someone told me I should make it both. So I was just blindly following that. I do want to be compliant with current standards. Thank you for helping me think about this!

1 Like

Well, I’d think whoever told you meant well. And I was simply answering your question. But it is definitely better (best) practice to use either www or @ (root domain), not both.

Excellent. I am absolutely sure the person who told me that meant well. And who knows, maybe I misunderstood him and he was suggesting that I drop the www. rather than implement both. Thank you so very much for your support!

Warmly,
Debra

1 Like

It is probably a misunderstanding. Both should exist in DNS, and result in people arriving at your website. But as a best practice you should pick one to be the canonical version, and redirect the other to it. Some people will just example.com or www.example.com into the address bar. They both expect to get to your website.

Google will essentially penalise you in search results if the exact same content appears in multiple places. By redirecting you avoid that penalty. You get the added benefit of cache hit rate improving, and better performance also leads to better search performance.

2 Likes

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