Key takeaways
- www and non-www rank equally — consistency is what counts.
- A CNAME on www is easier with CDNs.
- Redirect the other version with a 301 and cover both with SSL.
Both work, and search engines treat them equally. What matters is choosing one and redirecting the other to it.
The differences
www.example.com | example.com | |
|---|---|---|
| Looks | Traditional | Shorter, modern |
| DNS | Can be a CNAME (flexible with CDNs) | Usually needs an A record |
| Cookies | Can be scoped to www only | Cookies set on the bare domain are sent to all subdomains |
| SEO | Equal | Equal |
When www has a technical edge
- CDNs and load balancers often give you a hostname to point at. A
CNAMEonwwwis straightforward; the bare domain can’t have aCNAME(some DNS providers offer a workaround called ALIAS or CNAME flattening). - Cookie isolation — large sites with many subdomains can keep cookies off static-file subdomains.
For most small and medium sites, neither matters much.
What actually matters
- Pick one canonical version.
- 301-redirect the other to it, keeping the path.
- Use it consistently in your CMS settings, sitemap, canonical tags and links.
- Cover both with your SSL certificate, so the redirect works over HTTPS.
Redirect non-www to www (.htaccess)
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]