To www or Not to www — That is the Question

Share this article

In the dim and distant days at the dawn of the web, those publishing a URL on offline media would add the ‘www’ prefix. It informed everyone you’d moved into the twenty-first century and owned a piece of prime real estate on the World Wide Web. Fast forward to 2012. Everyone knows what the web is — few organizations publish their URL with a preceding www. People understand that Google.com, Facebook.com, Twitter.com and SitePoint.com are websites. Before we take this discussion further, your site must work with or without the www. For the sake of SEO and canonical/duplicate content issues, you should choose one domain option and redirect when the other is used. If you prefer naked domains, redirect to it when a visitor requests the fully-dressed www version. It’s not difficult — a three line Apache .htaccess file will suffice:


RewriteEngine on
RewriteCond %{HTTP_HOST} !^mydomain.com [NC]
RewriteRule ^/?(.*)$ http://mydomain.com/$1 [L,R=301]
The question is: which should you choose? Those in the pro-www camp point out that ‘www’ has not been deprecated. It’s unambiguous, technically accurate and distinguishes the address from similar URLs for FTP, mail or other data types. The anti-www camp point out that it’s simply not necessary. No one’s confused. URLs are shorter, easier to read and quicker to type. “Ahh”, says the pro-www lobby, “you’re just being vain”. “Well”, responds the anti-group, “you’re being finicky and my website looks far better than yours”. “Does not”, shouts pro, “Your site smells.” And so on. My opinion: it doesn’t matter. Pick one and stick with it. Some word combinations look better with the www, some look better without. Ultimately, it’s your personal branding preference and few people will notice or care. Just remember that your site should load regardless of the URL and redirect when necessary. If you’re breaking that rule, go and stand in the naughty corner and consider the consequences of your actions. Comments on this article are closed. Have a question about domains? Why not ask it on our forums?

Frequently Asked Questions about WWW vs Non-WWW Domains

What are the SEO implications of choosing WWW or Non-WWW for my domain?

The choice between WWW and Non-WWW does not directly impact SEO. Search engines like Google consider both versions as different entities. Therefore, it’s crucial to set your preferred domain in Google Search Console to avoid duplicate content issues. Regardless of your choice, consistency is key. Ensure all your internal links follow the same structure to avoid confusing search engines and users.

How does the choice between WWW and Non-WWW affect the user experience?

From a user’s perspective, there’s no significant difference between a WWW and Non-WWW domain. However, some users may naturally type “www” before your domain name out of habit. If you’ve chosen a Non-WWW domain and haven’t properly set up redirects, this could lead to confusion or difficulty accessing your site.

Can I switch from WWW to Non-WWW (or vice versa) after my website is live?

Yes, you can switch between WWW and Non-WWW even after your website is live. However, it’s important to properly set up 301 redirects to ensure users and search engines are directed to the correct version of your site. This will also help preserve your SEO rankings.

What is the technical difference between WWW and Non-WWW domains?

Technically, WWW is a subdomain, while Non-WWW is not. This means that WWW domains can have CNAME records (useful for pointing to other domains), while Non-WWW domains can only have A records (pointing to IP addresses). This could be a deciding factor if you plan to use a CDN or other services that require CNAME records.

Does the choice between WWW and Non-WWW affect website speed?

The choice between WWW and Non-WWW does not inherently affect website speed. However, if you’re using a CDN or other services that require CNAME records, a WWW domain might be more beneficial.

How do I set up redirects from WWW to Non-WWW (or vice versa)?

Setting up redirects can be done through your .htaccess file if you’re using an Apache server, or through the server block settings if you’re using Nginx. It’s important to set up a 301 (permanent) redirect to ensure all traffic is directed to your preferred domain.

What is a canonical URL and how does it relate to WWW vs Non-WWW?

A canonical URL is the URL that you want search engines to treat as authoritative. In the context of WWW vs Non-WWW, your canonical URL is your preferred domain. You can set this in Google Search Console and also use the rel=”canonical” link element on your webpages to indicate your preference.

How does the choice between WWW and Non-WWW affect cookies and subdomains?

If you’re using cookies on your site, a WWW domain can provide more flexibility. With a WWW domain, cookies can be restricted to a specific subdomain, whereas with a Non-WWW domain, cookies will be sent to all subdomains.

How do I choose between WWW and Non-WWW for my domain?

The choice between WWW and Non-WWW largely comes down to personal preference and your specific needs. Consider factors like user experience, technical requirements, and potential future needs. Regardless of your choice, consistency and proper setup are key.

Can I use both WWW and Non-WWW versions of my domain?

While it’s technically possible to use both versions, it’s not recommended. Using both versions can lead to duplicate content issues, which can negatively impact your SEO. Choose one version as your preferred domain and set up redirects to ensure all traffic is directed to that version.

Craig BucklerCraig Buckler
View Author

Craig is a freelance UK web consultant who built his first page for IE2.0 in 1995. Since that time he's been advocating standards, accessibility, and best-practice HTML5 techniques. He's created enterprise specifications, websites and online applications for companies and organisations including the UK Parliament, the European Parliament, the Department of Energy & Climate Change, Microsoft, and more. He's written more than 1,000 articles for SitePoint and you can find him @craigbuckler.

domainhostingwww
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week