www Vs TLD Debate
Top-Level Domain. For example, "gatlin.io".
For example, "www" in "www.gatlin.io" represents a subdomain. One justification for there usage, both historically and today, is to use subdomains to direct traffic to different sets of servers. For example, mail transfer servers could be at "mx.gatlin.io", file transfer servers at "ftp.gatlin.io", and internet servers at "www.gatlin.io".
"www" is historical and arbitrary. Network administrators needed to call the subdomain grouping their internet servers by some name, and they picked "www" and said it stood for "world wide web". And so it did, and so it does.
A webpage serves content. That content can, and often is, served from multiple webpages. For example, a website could serve the same content from "www.gatlin.io" and "gatlin.io". The search engine doesn't want to show the same content twice in its results. The content creator doesn't want to compete with themselves or cut their search performance in half. This is solved with the canonical link. Content creators can declare the "true location" of a piece of content within the content itself. That way, when a search engine crawls it, it can read the canonical url, and ensure that is the url shown in search results.
The debate is not about what URLs to support to begin with because the answer is: all of them. A user can type anything into an address bar. Ideally, a website will accept as many as they can and use various types of redirects to get the users to the content safely. Here's an example of all the different valid urls a user could theoretically type into an address bar.
gatlin.io www.gatlin.io http://www.gatlin.io https://www.gatlin.io http://gatlin.io https://gatlin.io
You can also add a "/" to the end of all of those and they should still work.
(Redirecting http -> https is a separate topic, but I'm under the impression that the best practice here is an application-level redirect. Subdomain / TLD redirects, however, can be handled by your domain name service provider.)
The debate is about canonical URLs. Should the canoncial URL be "www.[tld]", or just the TLD? There are websites devoted to arguing for and against dropping "www". dropwww and no-www argue for making tld canonical, while yes-www argues for making www canonical. I don't find the debate persuasive either way. The best answer to the question of "which is better?" that I've found is this answer to the question on ServerFault.
I am personally on the fence because I like the TLD-only aesthetic, but also like the categorization of subdomains in general.
You can look at the canoncial link in the head of webpages of major websites to see the choices they made. The easier method is manually visiting a website via both the www subdomian and the tld-only domain, and seeing how they redirect.
- www.stackoverflow.com redirects to stackoverflow.com
- www.github.com redirect to github.com
- www.vercel.com redirects to vercel.com
- www.tailwindcss.com redirects to tailwindcss.com
- www.duckduckgo.com redirects to duckduckgo.com
- google.com redirects to www.google.com
- heroku.com redirects to www.heroku.com
- amazon.com redirects to www.amazon.com
- netflix.com redirects to www.netflix.com
- mozilla.org redirects to www.mozilla.org
- hexdocs.pm keeps its TLD, while www.hexdocs.pm redirects you to hex.pm login page. They are basically pro tld, since they remove the "www".
(Fun fact: I noticed in writing this that strings beginning with "www." are automatically being converted to URLs in my markdown -> html pipeline. I don't want this to happen, but since it rarely matters I probably won't try and turn it off. I can't even tell if this is an argument for or against "www" as a canoncical URL.)
Believe it or not these are just the first 11 tech-focused companies I could think of, and they are split in half. They seem to be split perhaps on age and/or size, but even in my small sample there are outliers contradicting each of those theories. I think the takeaway here is you can do whatever you want. Probably, I will not go to the hassle of dropping www on my current setups, but for future websites I will make the TLD the canonical url.