The best and most effective way to resolve a canonical issue is a permanent 301 redirect. This can be implemented in the following detailed ways. Depending on which server your website is hosted on, that method will determine which method you use to implement the redirect.
In addition, it is also worth logging into Google Webmaster Tools and setting up two profiles for your domain; one with www. Prefix and one without. Then go to the site "Configuration> Settings> Preferred Domains" and choose which domain you want to use.
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{HTTP_HOST} ^108\.170\.28\.35
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^http://www.example.com/$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301][L,R=301] [L,R=301]
</IfModule>
Check out for more information visit our link