Originally, "www" served as a standard subdomain to identify web servers in the early internet (pre-2000s). This convention emerged because:
- Different services often ran on separate subdomains (ftp.example.com, mail.example.com)
- Helped with DNS load balancing when web traffic needed dedicated infrastructure
Today, the "www" prefix has these implications:
// DNS configuration example showing CNAME flexibility
www IN CNAME example.com. ; Allows separate CDN configuration
@ IN A 192.0.2.1 ; Root domain record
Key technical factors in 2023:
- Cookie Scope: www.domain.com sets cookies for all subdomains (*.domain.com)
- CDN Configuration: Many CDNs recommend using www for easier DNS setup
- SSL Certificates: Wildcard certs (*.domain.com) cover both variants
For Apache servers:
<VirtualHost *:80>
ServerName example.com
Redirect 301 / http://www.example.com/
</VirtualHost>
For Nginx:
server {
listen 80;
server_name example.com;
return 301 $scheme://www.example.com$request_uri;
}
Search engines treat these as separate URLs without redirection:
// Google Search Console treats them as separate properties
// Recommended verification method:
<meta name="google-site-verification" content="..." />
Testing with curl shows redirect overhead:
$ curl -I https://example.com
HTTP/2 301
location: https://www.example.com
...
# Adds ~100-300ms latency per request
Current breakdown among top sites:
- 53% use www (Google, Facebook, Amazon)
- 47% use bare domain (Twitter, GitHub, Netflix)
- Choose one canonical version (www or non-www)
- Set up 301 redirects in server config
- Verify in Google Search Console
- Update sitemap.xml and robots.txt
- Test all redirect chains with curl -L
Originally, "www" (World Wide Web) served as a subdomain to distinguish web servers from other services like FTP (ftp.example.com) or email (mail.example.com). In the early internet, this naming convention helped organize different services under a domain.
Today, the www prefix is largely optional due to:
- HTTP/HTTPS becoming the dominant protocol
- DNS improvements allowing flexible record configurations
- Simplified user expectations (users often omit www)
For Apache (.htaccess):
# Redirect www to non-www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301]
For Nginx:
server {
listen 80;
server_name www.example.com;
return 301 $scheme://example.com$request_uri;
}
Technical advantages of using the bare domain:
- Shorter URLs (better for sharing and memorability)
- Reduced cookie overhead (cookies set on example.com apply to all subdomains)
- Simplified DNS configuration (fewer CNAME records needed)
Cases where www could be beneficial:
- When using CDNs that require CNAME records
- For large-scale deployments needing cookie isolation
- When maintaining legacy system compatibility
Best practices for search engines:
- Choose one version as canonical (301 redirect the other)
- Consistently use your chosen version in all links
- Verify both versions in Google Search Console
- Set up proper 301 redirects (code examples above)
- Update all internal links to your preferred version
- Configure SSL certificates for both versions
- Update Google Search Console and Analytics settings