Have you ever wondered whether using www or non-www in your website domain affects SEO? Many website owners, especially beginners, are often confused about choosing between www.yourdomain.com and yourdomain.com. In fact, this decision can have a major impact on your website's ranking in search engines. In this article, we will discuss the differences, advantages, disadvantages, and how to set up the proper redirect so that your website is optimized.
Simply put, www is a subdomain traditionally used to indicate that an address is a website. Non-www is the domain version without that prefix. Both can actually point to the same content, but from a technical standpoint, Google considers them two different websites. This is what causes problems if not configured correctly.
If you do not specify which version is the primary (canonical) version, Google will crawl both versions. As a result:
The most important thing is not choosing www or non-www, but being consistent and configuring it correctly. Here are the steps:
Decide whether you want to use www or non-www. Consider the scale of your website. For large websites with many subdomains, www is recommended. For small websites, non-www is sufficient.
A 301 redirect is the most effective way to tell Google which version is canonical. Here is an example .htaccess script:
Redirect from www to non-www:
RewriteEngine OnRewriteCond %{HTTP_HOST} ^www\.yourdomain\.com [NC]RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]
Redirect from non-www to www:
RewriteEngine OnRewriteCond %{HTTP_HOST} !^www\. [NC]RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301]
In addition to redirects, you can also add a canonical tag in the HTML page section. Example for the www version:
<link rel="canonical" href="https://www.yourdomain.com/halaman" />
However, a 301 redirect is recommended because it is stronger.
In Google Search Console, you can specify the preferred domain (www or non-www) in the settings. Make sure it matches the redirect you created.
Use tools such as SE Ranking or Screaming Frog to ensure there are no duplication issues or incorrect redirects. Perform audits routinely.
Choosing between www and non-www is not a difficult decision. What matters is that you choose one, then configure the redirect and canonical correctly. Do not let both versions compete in search results. With consistency and proper technical setup, your website will gain maximum SEO benefits. So, have you made your choice?