www.example.com and example.com are two different domains, as far as the browser is concerned, apparently, although they are both directed to the same site. The same thing happens if you park another domain there, say example.net .
To solve the problem, quite often rewrite the URL through .htaccess. Determine which domain name you prefer to use, and add something like this to your .htaccess:
RewriteEngine On RewriteCond %{HTTP_HOST} ^www.example.com$ [NC] RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
or
RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com$ RewriteRule (.*) http://www.example.com$1 [R=301]
(the first removes, the second adds www)
source share