Look in your .htaccess file
Redirect www to non-www:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^
www.yourdomain.com [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]
Redirect non-www to www:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]
You should ALWAYS use one of these redirects everytime! This way search engines know which one you want to use and there is no danger in getting duplicate listings/penalties/etc for two different sites with the exact same content.