Search engines see www and non-www website structure of the same domain as different website addresses, this can be seen as duplicate content because of the same content served on both addresses.
So which is best www or non-www. Personally I use the www version as it’s generally a human accepted structure for URLs.
To achieve this consistent www version the .htaccess requires editing unless you are using WordPress in which case this can be set via ‘WordPress Address (URL)’ in settings/general.
The .htaccess redirection to add www:
And for those who prefer to remove the www.
Don’t forget to set your preferred domain in Google webmaster tools: https://support.google.com/webmasters/answer/44231