Any website can be accessed either WWW or non-WWW version. It can be harmful for search engine ranking.
Google and other search engines can see two separate versions with the same content. Basically “www” is the sub domain which can target to another content.
Any search engines based on how many incoming links are pointing to your website. When you keep two versions i.e. WWW or non-WWW, this will divide backlinks count. For example, one people will link to WWW version where as others will link to non-WWW. This can damage your ranking from google also.
To solve this issue the easiest way is to set up a 301 redirect from non-WWW to WWW version. So whenever any visitor type non-WWW version they will be redirected automatically to WWW version of website.
Read Also: DoFollow & Nofollow Link
There are really no SEO benefits for choosing WWW over non-WWW. Even Google has said that this all depends on your preference.
To Specify a preferred domain in Google:
- On the Search Console Home page, click on the site you want.
- Click the gear icon, then click Site Settings.
- In the Preferred domain section, choose the option you want.
When you prepend www. in your website, it acts as a hostname that can help with flexibility with the DNS and that has the ability to restrict cookies while using multiple subdomains. Whereas non-WWW domains also referred as naked domains that do not have a technical advantage.
So at last the main thing is that just pick one i.e. either WWW or non-WWW and stick with it.