That is the question:
Whether ‘tis nobler in the mind to suffer
The slings and arrows of outrageous fortune,
Or to take Arms against a Sea of troubles,
And by opposing end them: to die, to sleep Prince Hamlet
After choosing my domain name, which was no easy task (see CogitActive.com), I thought I was done with that matter. However, there was an issue left unresolved: should I use www in front of my domain name? Fortunately, the issue at stake had nothing to do with a Shakespearean tragedy. Indeed, Uniform Resource Locator (URL) formatting is apparently just
a matter of personal preference; still, I wanted to make an educated choice.
Which one is better?
Even though most articles would simply state that
there is absolutely no difference between www vs non-www, there is a long-lasting debate on that matter.
What is www?
Let me first remind you (see A domain name), that the www part of the URL is the name of the host, or hostname. It is an actual server. Given the way the Domain Name System (DNS) works, the hostname is important to return the Internet Protocol (IP) address of the exact server you need to connect to (e.g. in order to access a website). Thus, the hostname concatenated with the domain name is called the Fully Qualified Domain Name (FQDN).
Then, why many website URLs don’t include the www? Because if nothing is specified (i.e. empty hostname), the DNS will assume
a default hostname of www1.
www + non-www = 2 sites
Typically, both the www and non-www versions of the URL point to the same web page, but this is not always the case. In fact, they don’t have to: www.domain.com and domain.com can be completely separate sites. Either way, Google treat them as such!
Therefore, if the same content is served over both URL versions (and both versions of your site are accessible), there is a problem of duplicate content.
Same but different!
Despite the claim that
there is absolutely no difference between www vs non-www, there are two arguments in favor of using the FQDN (i.e. with www) instead of the so-called naked domain (i.e. without www).
The first has to do with cookies; not the sweet biscuit, but the small files stored on your computer when you visit a website. As they are passed in a hierarchical way, without the www, they are sent to all subdomains. On the other hand, having the FQDN allows restricting cookies to the www.domain.com website.
The second has to do with CNAME Records (see Pointing my domain name to my website). In theory, naked domain names cannot have a CNAME Record; they have to point to an IP address (i.e. an A Record). Therefore, you should not be able to set up a CNAME Record without messing up other things linked to your domain name, such as File Transfer Protocol (FTP) and e-mail. Yet, there are workarounds.
So, which one is better?
In absolute terms, it is better to go with the www version. Indeed, the cookie issue can slow down traffic, while the CNAME Record matter can be a serious limitation for flexibility DNS-wise. However, here is the thing; these highly specialized shortcomings only affect extremely large websites receiving millions of page views per day.
The technical reasons to use www primarily apply to the largest web sites which receive millions (or more) of page views per day, web sites with a large number of services across several subdomains, and virtually any web site hosted in “the cloud” by an application service provider.Michael Hampton
Consequently, for most websites, it doesn’t really matter which version you use; hence the statement that
there is absolutely no difference between www vs non-www.
A matter of personal preference
Although the FQDN is the preferred way to go, there are also non-technical motives to use the www. In particular, many people still associate www with websites. This is particularly relevant nowadays with the new Top Level Domain (TLD), such as .ninja among other interesting ones. Now, people will understand that it is a web address whether you have the www or not, especially with a .com TLD.
There are also reasons that push people to drop the www. First, it looks better or prettier. Second, the domain is easier to remember, spell, type and tell (I have read funny comments about the latter). Some even argues that you can save bandwidth – 4 bytes of data (www.) to be specific! While the arguments in favor of the non-www may be more aesthetical than technical, the non-www defenders often claim that the www is
so twentieth century.
Go with www!
Again, I wanted to make an educated choice. However, neither side (pro-www vs anti-www) was able to tip the scale in their favor. Granted, the FQDN was technically advantageous, but only for sites with extremely high traffic (clearly, I am not concerned). On the other hand, the reasons for dropping the www were quite puerile. As for the neutral articles, they were only considering this topic from a Search Engine Optimization (SEO) perspective. Apparently, it doesn’t really matter which one you are using SEO-wise; hence (again) the statement that
there is absolutely no difference between www vs non-www.
So, which one I chose? I decided to go for the one that was better
performance-wise, security-wise and in terms of flexibility2. Indeed, this article by Bjørn Johansen fully convinced me to
go with www – the security concern with cookies, in particular.
Ironically, this pro-www article – like many others3 – has a non-www URL!
Pick one and stick to it!
The dispute between pro-www and anti-www may never end, still, there is one thing they all agree on – you should not use both.
As stressed earlier, search engines (i.e. Google) consider www.domain.com and domain.com to be two different websites, even if they both point to the same site. To avoid duplicate content, you should make sure that your website is not accessible over both www and non-www. In addition, you should set a preferred domain, also referred to as the canonical domain. Last, it is important to be consistent that is to always use the same format for your internal links.
Fortunately, if you are using WordPress, this process doesn’t require your attention. Indeed, WordPress 2.3 introduced the “canonical URLs” feature, which automatically redirects all incoming links to the proper URL. You may not be aware of this feature, and I believe too many professionals don’t (or still run pre-2.3 versions of WordPress; see box below).
Anyway, all you have to do is to access your WordPress dashboard and to navigate to Settings and then General. There, under the WordPress address (URL) and Site address (URL) fields, enter your preferred URL (without slash at the end). The first URL (homeurl) indicates where your WordPress core files reside. The second (siteurl) is the address you want people to type in their browser to reach your site – the one that matters for the topic at hand. For a newly installed WordPress (as in my case), that is it!
Greatly simplified, the .htaccess file is a configuration file that indicates to the server how to rewrite URLs, among other things. Most – if not all – articles on the topic at hand, explain that you have to add some lines of code to your .htaccess file in order to redirect www URLs to non-www, or vice versa. The code implements a 301 redirect, which permanently forward one URL to another.
As stressed earlier, WordPress provides a built-in redirect feature. For this reason, you don’t have to manipulate your .htaccess file. Granted, if you don’t use WordPress or if you are running a pre-2.3 version of WordPress, you may have to add new rules in the .htaccess file.
So, why so many articles still instruct WordPress users to accomplish this by manipulating their .htaccess file? Here is an attempt at explanation. In so far, many authors
update recycle their articles over and over, their content could be older than September 25, 2007 (the release date of WordPress 2.3). This is the nice version; you don’t want to ask about the mean one.
Time for action
There is not much to say. As explained earlier, in my WordPress dashboard, I navigated to Settings and then General. There, I replaced the previous WordPress address (URL) and Site address (URL) with the following one4:
I clicked on the Save Changes button and I was done.
Less than thirty minutes later, I reverted my URL back to the non-www version! After pondering the pros and cons of www vs non-www for days, and deciding on www as the best approach (see above), why did I change my mind? Actually, there is a good reason and it goes like this.
As soon as I was done with this task, I moved to my next assignment: to learn more about WordPress Multisite. As I intended to have multiple websites using subdomains (see A domain name), I was trying to figure out which method was best: using multiple WordPress installation or using WordPress Multisite. I already had a good idea of which method I wanted to implement, but I decided anyway to read one more article to be sure: Before You Create A Network.
Indeed, this article from the WordPress codex addresses questions like
do you really need a network?, as well as requirements to create a WordPress Multisite. I was getting more and more confident with my decision until I reached the “Be Aware” section at the end of the article.
We recommend you change your siteurl to example.com before enabling the network feature.
As I said, I was pretty much convinced that I wanted to create a WordPress Multisite. However, I also decided to go with www. How to reconcile both when you read things like this:
It’s not recommended to use www in your domain URL.
Actually, the article was rather clear for that matter:
For this, and many other reasons, we do not suggest you use www in your domain name whenever possible.WordPress codex
Would the article be from any other source (i.e. not the codex), I would have stick to my decision to go with www. However, given the relatively limited technical advantages of www over non-www (see above), I didn’t give it a second thought and immediately revert my WordPress settings to the non-www URL.
So much for my readings on which URL is best5!
1 Peter Pollock (2013) Web Hosting For Dummies. Hoboken, New Jersey: John Wiley & Sons. ^
2 Bjørn Johansen (2017) To www or not to www – Should you use www or not in your domain? ^
3 Hold your comment about my URL, and keep reading. ^
4 That is correct, HTTP and not HTTPS. At the time, I did not properly re-configure my WordPress installation to work through HTTPS. Instead, I used the Enforce HTTPS tool provided by SiteGround (see Let’s Encrypt). ^
5 In keeping with the www vs non-www debate, if you inquire about your individual websites – some being subdomain based like this blog – in Google, there is a clear advantage of the www version over the non-www one. Indeed, when I search for site:cogitactive.com, Google’s results include not only the pages of my main site (cogitactive.com), but also those of my blog (blog.cogitactive.com). Of course, a search for site:blog.cogitactive.com provides only the blog pages. ^