Your Domain Name: Do You www or Not?

Share this article

Your Domain Name: Do You www or Not?

Key Takeaways

  • Despite the ‘www’ prefix being technically accurate and avoiding confusion with similar URLs for other protocols, it is not necessary in modern times. Most people understand that a .com, .org, or .net address is a website, even without the ‘www’ prefix.
  • Whether to use ‘www’ or not often comes down to aesthetic preference and ease of typing. However, it’s important to ensure both the ‘www’ and non-‘www’ versions of your domain are accessible, as users may type either. This can be achieved with a simple web server configuration setting.
  • Once a decision is made to use or not use ‘www’, it’s crucial to stick with it. Switching between the two can cause issues with search engine indexing and user accessibility. If a switch is made, a 301 redirect should be used so search engines update their indexes accordingly.

This article is part of a series created in partnership with SiteGround. Thank you for supporting the partners who make SitePoint possible.

In the early days of the web it was imperative to publish your web address with a ‘www’ prefix. Those three characters prevented confusion; it was more obvious you meant a web domain. But is the ‘www’ necessary in 2017? The web is prolific and few organizations opt to publish their URL with a preceding ‘www’. People understand that Google.com, Facebook.com, Twitter.com and SitePoint.com are websites. The dot-something top-level domain (TLD) such as ‘.com’ makes this more obvious but, even without it, the web is normally the first point of call for anyone looking for a company or service.

The Case For ‘www’

The ‘www’ prefix has not been deprecated. It’s unambiguous, technically accurate and distinguishes the address from similar URLs for protocols such as mail or FTP. While a web address may be identifiable from it’s .com or country-specific prefix, hundreds of top-level domain options have been introduced in the past few years. If you’re using a less recognisable or ambiguous TLD, such as mysite.ninja, adding a ‘www’ will help avoid any doubt. Without the ‘www’, you must set your root (non-www) domain DNS A-record to point at your web server’s IP address. This can be too rigid if you encounter availability or performance issues; the A-record is fixed and can take a day or two for changes to propagate. A ‘www’ sub-domain can be configured using a DNS CNAME record which can be updated and changed instantly. You also need to be cautious of cookie and client-side storage. A cookie, sessionStorage, or localStorage value set for a non-www domain is shared throughout all sub-domains. If your primary website — mysite.com — sets 10Kb of cookie data, it’ll be transmitted with every request and response for app.mysite.com whether that application uses the data or not. Finally, the ‘www’ prefix is essential in applications such as email clients and word processors which transform text to links.

The Case For No ‘www’

Despite the technical issues raised above, using a non-www domain is rarely a problem unless you have complex hosting or application requirements. Root addresses are easier to read, quicker to type and fit easier in smaller (mobile) browser interfaces. The address is more likely to work your next tweet without having to use a URL shortener. Few people will be confused — especially when many use the Google search box rather than the browser address bar.

It’s Mostly a Vanity Thing

Some domain names look better and more balanced with the ‘www’, e.g.
  • www.google.com
  • www.facebook.com
  • www.bbc.co.uk
Some look better without:
  • twitter.com
  • yahoo.com
  • wikipedia.org
Some appear to work well in either orientation:
  • sitepoint.com / www.sitepoint.com
  • amazon.com / www.amazon.com
  • dropbox.com / www.dropbox.com
Choose whichever suits your domain but…

Configure It Wisely

Users may or may not add a ‘www’ so ensure both the www and non-www address works when a browser request is made. This can be achieved in serveral ways but the easiest option can be a web server configuration setting. The following code in configures Apache to redirect all non-www requests to the www version of the URL. Add it to a .htaccess file in your web root:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Alternatively, this .htaccess redirects all www requests to the non-www URL:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
This allows you to publicise the ‘www’ domain in documents or emails even if it’s not required. You should also be wary if your site is served over secure HTTPS. SSL certificates are often valid for both the non-www and www domain but there’s no guarantee. Check with your Certificate Authority — it may be necessary to purchase an additional or wildcard certificate if you have the wrong one. Some hosting providers, like our partner SiteGround, let you order an SSL certificate that will work with your domain with or without the www prefix. Finally, make a decision and stick with it. Never switch between non-www and www URLs on a whim! The .htaccess code above issues a `301 Moved Permanently` HTTP redirect code so browsers and search engines update their indexes accordingly. It can take time for changes to disseminate; users could encounter access problems while that occurs. Did your company opt to use or drop the ‘www’? Was it a success? Did anyone notice?!

Frequently Asked Questions (FAQs) about Domain Names

What is the difference between a domain with www and without www?

The difference between a domain with www and without www is primarily cosmetic. The www is a subdomain, and it was traditionally used to indicate that a site was part of the web, as opposed to other parts of the Internet like FTP or Gopher. However, in modern usage, it’s largely unnecessary and many websites choose to omit it. Technically, www and non-www versions of a domain are considered separate entities by search engines, so it’s important to redirect one to the other to avoid duplicate content issues.

How can I configure my website to be accessible with and without www?

To make your website accessible with and without www, you need to set up a DNS record for both versions of your domain. This can usually be done through your domain registrar or hosting provider’s control panel. You should also set up a 301 redirect from one version to the other to ensure that search engines only index one version of your site.

Why is my website not working without www?

If your website is not working without www, it’s likely because you haven’t set up a DNS record for the non-www version of your domain. You need to create an A record for your domain without the www, pointing to the IP address of your web server. This can usually be done through your domain registrar or hosting provider’s control panel.

Can I use a domain without www with Cloudflare?

Yes, you can use a domain without www with Cloudflare. You just need to add a DNS record for the non-www version of your domain in your Cloudflare dashboard. You should also set up a page rule to redirect www traffic to the non-www version of your site, to ensure that all visitors end up at the same place.

What is a .no domain?

A .no domain is the country code top-level domain (ccTLD) for Norway. It’s used by websites that are targeted towards audiences in Norway. Like other ccTLDs, it can be used with or without the www prefix.

How can I redirect www to non-www in my .htaccess file?

To redirect www to non-www in your .htaccess file, you can use a simple rewrite rule. Here’s an example:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

This rule will redirect all traffic from www.yourdomain.com to yourdomain.com.

Is it better for SEO to use www or non-www?

From an SEO perspective, it doesn’t matter whether you use www or non-www. What’s important is that you choose one version and stick to it, to avoid duplicate content issues. You should also make sure to set your preferred domain in Google Search Console.

Can I switch from www to non-www without affecting my SEO?

Yes, you can switch from www to non-www without affecting your SEO, as long as you set up a 301 redirect from the old version to the new one. This will ensure that any link juice from the old version is passed on to the new one.

Why do some websites still use www?

Some websites still use www for historical reasons, or because they have subdomains and want to keep their URL structure consistent. However, it’s largely a matter of personal preference and there’s no technical reason to use www in modern web development.

Can I use a domain without www with WordPress?

Yes, you can use a domain without www with WordPress. You just need to set your WordPress Address and Site Address to the non-www version of your domain in your WordPress settings. You should also set up a 301 redirect from the www version to the non-www version, to ensure that all visitors end up at the same place.

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.

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