Do typically include www when typing a website name into a browser’s address bar? Can you tell whether Wikipedia, Amazon, Facebook, and Twitter use www or not? Don’t worry if you can’t because you aren’t alone in this.
Since popular web browsers like Google Chrome and Safari now hide the www part of URLs, it’s easy to overlook the presence of the “www” prefix in the names of popular websites. Amazon is www, but if you type amazon.com instead of www.amazon.com into the search bar, you’ll still be able to enjoy the convenience of prime delivery for your new pair of sneakers.
In the early days of the Internet, www was an essential component of any domain name. With no hosting providers, every company used to manage their own servers, and prefixes were used to differentiate between various servers. Files stored on the www server would be intended for sharing on the web, and the website name would be www.example.com. Ftp servers were used to share files within the network, mail servers were used to handle email delivery, and the list goes on.
Even today, you can come across terms like a fully-qualified domain name (full domain name with a prefix) and root domain, but with no prefix. An important change is that now, a fully-qualified domain (www.example.com) and a root domain (example.com) connected to the same IP address of a single server will both work properly.
In this article, we’ll explain why keeping www in your site name could be beneficial (even though it’s no longer mandatory.) We’ll also discuss how to better communicate to Google and other search engines which version of your site is preferable. We’ll also look into some canonical issues that may arise from using www vs non-www.
Whether you choose the www or non-www route, you’ll need a proper technical setup, which will be a solid foundation for the future of your SEO growth.
Why is www vs non-www important for SEO?
So, does the choice between www and non-www impact seo? In short, Google and other search engines don’t really care either way. What matters is how you inform search engines about your preferred variation or, in SEO terms, the canonical one.
Here’s an old Twitter conversation, where John Mueller confirms that you shouldn’t worry too much about choosing www vs no www:
Since search engines treat www and non-www site versions as two separate websites, you should explicitly communicate to search engines which version of your site to crawl and index, and which to ignore. Failure to do so will result in both versions being indexed, leading to competition between the www and non-www website variations in the SERPS. This will prevent each version from getting the rankings it deserves.
There are several SEO issues associated with this scenario:
- Duplicate content. Search engines value original and unique content. Whenever multiple pages have identical or almost identical content, they are considered duplicates. In the case of www and non-www duplicates, Google will do its best to determine which version to prioritize. Still, a better approach would be to avoid leaving this decision to search engines and instead use redirects or canonical tags to specify your preference. More on that later.
- Wasted crawling budget. Search engines have a limited crawling capacity. By not specifying your preferred site version, you force them to crawl each page twice. This means search engines may exhaust their crawling budget before fully scanning all the important pages on your site. This would be a total shame.
- Diluted backlink value. High-quality backlinks can significantly boost your rankings, provided that they point to the right variation of your site. Unless you set up a redirect or use a canonical tag, backlinks pointing to the www version of your site will only bring value to that version, while non-www pages will only benefit from backlinks pointing to the respective non-www URLs.
Being undecided about using www or not is a bad SEO decision. So, once you’ve made up your mind, here’s how to proceed.
Redirect or canonical tag: how to better indicate your preferred site version
When it comes to indicating your preferred domain name, you have to choose between using a server-side 301 redirect or adding a canonical tag. Both options aren’t too technically complicated to implement, and the majority of modern CMSs offer built-in functionality, making redirect and canonical tags even easier to set up.
From the user perspective, there is a distinction between using 301 redirects and rel=canonical tags. With rel=canonical tags, the URL displayed in the browser’s address bar and history doesn’t change. For example, if, a user tries to access ‘example.com’, they will see that exact URL in the address bar even if www.example.com is your canonical variation. But since popular web browsers skip www these days, users won’t even notice the difference.
Now, let’s discuss each option in greater detail.
Setting up a 301 redirect
The most common and SEO-friendly approach would be to set up server-side 301 redirects. This involves editing the .htaccess file at the server level. Also, search engines recognize redirect instructions as mandatory.
For website visitors, redirects from www to non-www or vice versa work as follows:
Whenever a user enters the non-canonical version of your domain name in the address bar and sends a request to your site’s server, the server responds with a 301 redirect to the browser. This automatically redirects the user to the ‘proper’ canonical equivalent of the page. If, for example, your preferred site version is www.example.com and a user types example.com/page01 in the search bar, they will end up on www.example.com/page01.
The same logic applies to search engine bots that crawl and index your site. They won’t be able to access the non-canonical version of your domain, which means that Google and other search engines will successfully index the right version of your site.
On top of that, redirects are good at passing the link juice, which means that your www site version will benefit from the backlinks that point to the corresponding non-www pages.
To set up a 301 directly via the .htaccess file, which is located in your website’s root folder, you’ll need to add a few lines of code to it.
If you have decided to use the non-www version and want to redirect users and bots trying to access the www-version, add the following lines of code:
RewriteEngine On RewriteCond %{HTTP_HOST} www.yourwebsitehere.com RewriteRule (.*) http://yourwebsitehere.com/$1 [R=301,L]
If your preferred version is www.example.com, and you need to redirect from non-www to www, add these lines of code:
RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Depending on your CMS, you may be able to set everything up by check-marking the necessary field in the CMS settings or by using a plugin.
Adding canonical tags to your site pages
If you have no technical means to set up 301 redirects, you can add the rel=canonical <link> tag to the HTML code of all pages of your non-preferred site version. A canonical tag instructs search engines in determining which among similar pages should be considered the main one, ensuring its indexing and ranking, while disregarding the others.
While canonical tags serve as recommendations rather than strict instructions, they aren’t as reliable as 301 redirects. Based on other signals such as sitemaps, or internal and external links, it may choose different canonical pages than those specified through canonical tags.
Here’s how you can implement rel=canonical tags. Let’s assume your preferred version is www.example.com. To indicate that https://www.example.com/page01 is your preferred page version, you’ll need to add the following line of code to the <head> section of https://example.com/page01 HTML code:
<link href="https://www.example.com/page01" rel="canonical">
Starting from WordPress 2.9 or higher, rel=canonical tags are automatically added to all pages of your website. You don’t need to take any additional action on your own. The tags will either point to www or non-www versions of your website depending on the one you specified as your WordPress Address (URL) in the general settings of WordPress.
Keep an eye on your redirects and canonicals setup
Once you decide whether to use www or non-www and you have marked your preferred version as canonical by using either of the two methods described above, it is advisable to check if everything went well. Tools like SE Ranking’s Website Audit will be of great help here. By regularly monitoring your website’s health, you can ensure that no technical bugs jeopardize your SEO growth.
To check if everything is set up properly on your website, you can start your 14-day free trial. The system will automatically audit your website as soon as you add your project to the platform.
In the Duplicate Content section of the Issue Report, you’ll get notified if something went wrong. This includes indications of potential issues with your redirects or instances where multiple canonical tags are added to the same page.
In the HTTP Status Code section of the report, you’ll see if any of your canonical URLs aren’t functioning properly. This includes situations where the URLs are redirected to other destinations (3xx status codes), have been deleted (4xx status codes), or are temporarily unavailable due to server errors (5xx status codes.) Every issue in the report comes with tips on how it can be fixed, along with a list of the affected pages.
Finally, if you used canonical tags to indicate your preferred site version, make sure to regularly check which pages Google actually considers canonical. You can do this manually by using Google Search Console or with SE Ranking’s Rank Tracker. Check out this guide for detailed instructions.
Use www or non-www consistently
Consistency is key, and your www or non-ww URL variations are no exception. Whichever version you choose, stick to it. For example, if you keep www, make sure all your Sitemap URLs, internal links, and backlinks are www.
Search engines rely on your Sitemap as a comprehensive guidebook that outlines all the pages you want to crawl and index. Make sure to use correct URL variations in your sitemap to avoid sending confusing signals to Google, especially if your site utilizes canonical tags to indicate the canonical (or preferred) domain name. Fortunately, SE Ranking’s Website Audit will ping you if you ever mess things up.
The same applies to internal links, which send powerful signals to Google about which pages are the most valuable. Internal links also pass link juice, so ensure that you’re distributing link juice wisely by using the right link URLs. In the Found Links section of the Website Audit, you can find a complete list of your internal links. Use filters to check if any of the links use a non-canonical URL variation. In the example below, we will be searching for non-www URLs since the website’s preferred version is www.
When possible, you should also try to control URL variations used by sites linking back to you. If your canonical domain is www, your backlinks should ideally feature this prefix. The same applies to backlinks from affiliate websites. With these kinds of backlinks, you have more control and can arrange for your business partners to use proper URL variations.
You should also pay attention to social media links. While social media links do not really strengthen your backlink profile, they still partially affect your SEO rankings.
To get a complete list of your website’s backlinks, you can use SE Ranking’s Backlink Checker. Once again, you’ll want to use filters to find backlinks pointing to non-canonical URLs. The website in the example below is www, but it has plenty of backlinks pointing to non-www page variations. If you find any of the detected backlinks particularly valuable, consider contacting the websites in question and requesting that they update the URLs of those backlinks.
In short, be consistent with the URL variations that your team and your partners use. Search engines will appreciate your efforts and reward you with better rankings.
Benefits of using www or non-www
SEO-wise, keeping or skipping www makes no big difference, but there are benefits associated with each option. For www, the benefits are very technical, and in some cases, keeping www is a necessity. On the other hand, non-www is generally considered to be better for branding. Now, let’s dive into the details to gain a better understanding.
www for handling loads of traffic
In the intro of this article, we mentioned Wikipedia, Amazon, and Facebook. One reason why these are all www is that they rely on content delivery networks (CDN) to quickly and securely deliver content to millions of their users.
What does this have to do with www or no www?
When opting for the non-www approach, it is common to map both the root domain and hostname to the same IP address provided by your hosting provider. This is achieved through an A-type record. The DNS record would appear as follows:
example.com. IN A 192.0.2.0 www.example.com. IN A 192.0.2.0
According to DNS specifications, root domains should always point to an IP address. Challenges arise when using CDNs since you need to point your website to a CDN domain rather than an IP address.
Theoretically, you can map your domain both to an IP address using an A-type record and to a CDN domain using a CNAME record. But another DNS rule states that a CNAME record cannot co-exist with other resource record types. This means that if you add both records, the A-type record pointing to the IP address will be ignored, thereby violating the first rule.
To simplify things, pointing to a CDN domain is not possible due to the nature of DNS requests.. This configuration will result in unexpected errors and won’t let your website function properly.
At the same time, if you opt for the www version of your website, you won’t have any problems complying with DNS rules. You would create a CNAME record for the www site, mapping it to a CDN of your choice. You would also add an A record for your root domain, directing it to your website’s IP address.
www.yourdomain.com. CNAME somecdn.com.
yourdomain.com. A 192.0.2.1
It is also worth mentioning that some DNS providers like Cloudflare, DNS Made Easy, and DNSSimple have introduced workarounds to overcome DNS restrictions. But relying on these workarounds will limit your choice of DNS providers. You may also experience hindered user experience because of users being routed to a far-away CDN node.
www for taming website cookies
In addition to DNS limitations, choosing a root domain as canonical raises concerns about cookies. In modern browsers, the main domain’s cookies are automatically transmitted to subdomains. This means that if you set cookies for example.com, they will also be sent to static.example.com, email.example.com, etc.
Here’s why this is a bad thing.
- The first issue is the impact on user experience. Bigger websites typically store their static content (such as images, videos, JavaScript, and CSS files) on a subdomain to offload the main server and handle dynamic requests efficiently. But if the website runs as the root domain, cookies will still be sent from example.com to static.example.com, resulting in slower access to static content and compromising website performance. The only way to prevent this bandwidth waste is by storing your static content on a completely separate domain. Twitter, for example, adopts a non-www approach and hosts their static content on a0.twimg.com as a solution to this problem.
- The second problem involves security risks. When you log into your website’s CMS, a cookie is issued. And when you visit mail.example.com or cdn.example.com, the cookie is sent to these subdomains, and can then be read by server administrators. This poses a security risk because administrators can copy the cookie and use it to log into your corporate CMS. To mitigate this risk, one possible solution is to implement IP restriction, which only allows access to your website from specific IP addresses associated with your corporate network.
So, if you want to optimize your website’s speed by hosting static content separately but don’t want to purchase a whole new domain, keeping the www prefix in your preferred domain name is a viable option. This will also prevent third parties from reading your website’s cookies.
Non-www for branding and ease of use
If your website isn’t large enough to require a dedicated CDN or if you don’t have subdomains that could interfere with your cookies, opting for the non-www version may be the better option. Despite the technical limitations, you can still go for non-www and make use of the available workarounds.
Here’s why you might consider this option.
At first sight, the non-www URL looks neater and more appealing. It also rolls off the tongue easier. As English author Douglas Adams once noted, it takes three times longer to pronounce the abbreviation www than simply saying “World Wide Web”. So, it’s no wonder broadcasters normally drop the www part when mentioning a website on-air. This is actually what most people do when saying the name of a website out loud.
When typing a domain name in the address bar, users who don’t remember the early days of the Internet typically often skip the www part. Even old-school users who still add www to the URL address won’t see it displayed in the address bar because browsers automatically hide it anyway. It is likely that in the future, www will become analogous to a steam train in the world of railways and will only be used sparingly.
To www, or not to www
The decision to include or exclude the www prefix in your domain name may seem like a small one, but don’t let your first impressions fool you. This is a big decision that can make a big difference. www vs non-www choice affects your branding and your website’s scalability, so make sure to choose wisely based on your priorities and future plans. And once you make the decision, mark your preferred version as canonical and stick with it. Switching back and forth from www to non-www is technically possible, but it won’t do your website’s SEO any good.