Suppose you have a site with the domain mysite.com. Google will see www.mysite.com and mysite.com as two different sites. This can affect you rankings, although there is (as always) discussion out there about just how much.
Its important to tell goolge which of these is there prefered domain often called the “canonical” domain – personally, I like the www version, so I normally set this via the google developer tools for my sites. Here’s a quote from google themselves:
Once you tell us your preferred domain name, we use that information for all future crawls of your site and indexing refreshes. For instance, if you specify your preferred domain as http://www.example.com and we find a link to your site that is formatted as http://example.com, we follow that link as http://www.example.com instead. In addition, we’ll take your preference into account when displaying the URLs.
Also, as a belt and braces thing I often set a 301 re-direct in the .htaccess file. This then means that should anyone follow a link such as http://mysite.com/apples they will be automatically redirected to http://www.mysite.com/apples – and this is what will appear in the browser window.
You can set the .htaccess file like this
Options +FollowSymLinks
RewriteEngine On
#to send mysite.com -> www.mysite.com
RewriteCond %{HTTP_HOST} ^mysite\.com
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=permanent,L]
There’s lots of good info out there on how to edit the .htaccess file – try