In the “.htaccess” file in the root of your website you need to add the following code to the TOP of you file.
# Handle duplicate content with redirects
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.(.*) [NC]
RewriteRule ^(.*) http://%1/$1 [R=301,L]