Either works for search and visitors, as long as you choose one and permanently redirect the other to it. The real differences are technical: a www name can be a CNAME pointing at your host, while the bare domain usually cannot, and cookies set on the bare domain reach every subdomain. Consistency matters far more than the choice.
| Question | www.example.com | example.com |
|---|---|---|
| Can it be a CNAME to a host? | Yes | Not in plain DNS; needs ALIAS or flattening from your DNS host |
| Cookie scope | Can be kept to www only | A cookie with Domain=example.com also reaches every subdomain |
| Typing and print | Four characters longer | Shorter |
| Search | Fine as the chosen version, with the other redirecting | Fine as the chosen version, with the other redirecting |
Updated
Many small business sites answer on both addresses without meaning to, which splits links and leaves search engines to guess which is the real one. Fixing it takes one decision and two small changes: a permanent redirect from the version you drop, and a canonical tag on every page naming the version you keep. Answer the questions below for a recommendation and the code to apply it.
Answer three questions. The recommendation and code update as you change an answer.
One server block catches the dropped name on both ports and sends everything to the chosen one with a 301.
server {
listen 80;
listen 443 ssl;
server_name example.com;
return 301 https://www.example.com$request_uri;
}Every page names its own address on the chosen version, which backs up the redirect.
<link rel="canonical" href="https://www.example.com/services/">The www name is a CNAME to the host; the bare domain keeps an A record pointing at whatever performs the redirect.
www.example.com. 3600 IN CNAME sites.host-example.net.
example.com. 3600 IN A 192.0.2.80
Hosting platforms often ask you to point your domain at a name they control with a CNAME, so they can move servers without you changing DNS. That is easy for www. At the bare domain, plain DNS only allows A and AAAA records with fixed addresses.
Cloudflare's documentation describes CNAME flattening as a way to use a CNAME at the zone apex: it follows the chain and returns the final IP address instead. Other DNS hosts sell the same idea as ALIAS or ANAME records.
Add the redirect and canonical tag on the same day, then resubmit the sitemap with the chosen version. Old links keep working because the redirect forwards them, path and all.
Watch the Pages report in Search Console for a few weeks. Pages on the dropped version should drop out as redirects while the chosen version takes their place.
Google's guidance on duplicate URLs is about picking one version, not about which one. What hurts is serving the same pages on both, because Google then has to pick a canonical. Its documentation calls redirects and rel=canonical strong signals, so use both to tell it which one you chose.
The DNS standard says no other data should sit at a name that holds a CNAME. The bare domain must carry SOA and NS records, so a CNAME there breaks that rule. Some DNS hosts offer ALIAS records or CNAME flattening to get the same effect.
A cookie set without a Domain attribute stays with the exact host that set it. A cookie set with Domain=example.com is sent to example.com and all its subdomains, such as shop.example.com, which can leak data or add weight to every request there.
A 301 or 308, because the choice is permanent. Google uses a permanent redirect as a signal that the target should be canonical, and a temporary one does not carry that signal.
Check the settings for a primary domain option. Most hosted builders let you connect both names and mark one as primary, then redirect the other for you. Test both addresses in a browser to confirm.
Related: Domain forwarding, Redirect rules generator, Redirect checker, Add a custom domain, DNS record types, Google Search Console guide.
Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.
We.Inc is an AI-powered website builder you can resell under your own brand. Launch a branded client dashboard, bill on Stripe Connect, and deliver AI-generated websites in minutes. White-label plans start at $99 a month for 25 client sites, with a 7-day free trial and no per-site fees.