Paste the following code below into your .htaccess file located in public_html/*

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.google.com [NC]
RewriteRule ^(.*)$ http://www.google.com/$1 [R=301,L]
Which will redirect

http://google.com
to http://www.google.com

Very useful for scripts which detect if you are logged in from a specific domain

*This will only work with servers that have .htaccess files enabled within their apache config - WHUK offer cPanel / Shared Linux packages which offer this service