In 2018, recurring question among website and domain owners is whether to choose www or non-www suffix URLs for SEO. or 20 years or so, there has been the debate over whether you should use www or not in your web site’s canonical hostname. So should you use www or not? Still many of webmasters are confuse to choose, because both have advantages and disadvantages.
What is a domain name?
A domain name is also your website name. A domain name is the address where Internet users can access your website. A domain name is used for finding and identifying virtual computers address on the Internet. Computers use IPv4 or IPv6 addresses, which are a series of number. However, it is difficult for humans to remember strings of numbers. Because of this, domain names were developed and used to identify entities on the Internet rather than using IP addresses.
Since the origin, “example.com”, and the hostname, “www.example.com” can point to different IP-addresses – and since January 1997 to different web sites on the same IP-address – people knowledgeable of SEO started telling us that we had to choose a canonical hostname and that the other should point there (with a HTTP 301 response code)
Should you use “www” in your URL or not?
It’s a question for the ages: to use domain as www or non-www. For years, people have been asking if there’s any difference between the two, which one (if any) is better for SEO, and whether or not they need to change their site address.
Today mid 2018, all we know both are treated same by search engines and no extra benefit to choose for SEO purpose. But there are some technical benefit to choose www over non-www.
Root Cookies are passed down to all subdomains-
Cookies serve from a root domain, will also be sent to all subdomains. I.e. if the website on “example.com” serve a cookie, the browser will also send this same cookie when visiting “www.example.com” or any hostname like cdn or mail and so on. Cookies are sent from the browser for each and every request to the web server. This means that if your website sets a cookie for the origin (“example.com”) this cookie will also have to be sent to every request that you make to e.g. “cdn.example.com” or “www.example.com”. This slows down the communication and leaves your with a worse user experience.
So, if your CMS like WordPress is located at the root domain (“example.com”) and have a login to a WordPress, the CMS will issue a cookie to your browser to keep you logged in for at least the session. Then, when you visit “www.example.com”, the WordPress can read that cookie through browser, copy it and use it to login to your website. If you’re concerned about the security of whatever you have on website, you must not use naked non-www domain. make sure you use a “www”- in front of it if you want more security. Neither HTTPS nor 2FA will help you out, since that cookie is the login token to access your website.
Naked Non-www domain can’t be a CNAME-
There is a limitation in DNS which says that the root, must be an A or AAA type record, which means it has to point to a fixed IPv4 or IPv6 address. You can’t set CNAME to use external services which only offer CNAME, You manually have to find A or AAA records to bypass CNAME records on DNS services.
Now, if your website is hosted at the root (“example.com”), you can’t do that. But there is no issue with the “www” hostname to set a CNAME record as it’s a technically subdomain. So if you want any scaling flexibility, now or in the future, you should go with the www hostname from the beginning.
Should you use “non-www” in your URL or not?
Non-www is prettier and easier and removed extra “www.” from your website links. I have to admit: “example.com” is shorter to type, easier to read out and it simply remove space from your domain. It is fully understandable that people started dropping the “www”-part and just went with the origin as the canonical hostname.
- According with The Internet Society, you can set a cookie with a empty domain parameter and the cookie will be valid only for current host-request. So, if the current host request is example.com and the cookie is set with a empty domain parameter, the cookie is not shared with any subdomain, including www. But be aware that domain=example.com is like domain=.example.com (with a preceding dot) and the cookie willing be shared with any subdomain. if you want a cookie only for root domain, the cookie must be set from a root domain request and with empty domain parameter.
- Actually, there are several DNS providers that allow CNAME-like records for root doamin. So in modern age there are no technically limitation while using naked non-www domain.
Conclusion: Both are same:
According to me, www is somehow good, but its your choice. As today both are treated same by visitors and search engines like Google too. Here is the standard thing that people do stick to one.
Usually the “www” subdomain. Make a 301 redirect from root domain (non-www) to the www subdomain. This will help your Google ranking. If you support just both, your Google rank will split between two. If you do not use redirect people might think that website has gone defunct. 301 also helps Google to understand that you want people to prefer the one where you are redirecting.