This is a handy little snipped to include in you .htaccess file. It will add the 'www.' part to a domain name that was entered without it. It leaves explicit subdomains alone. So, if you would enter 'mysite.com' it would do a redirect to 'www.mysite.com', but if you entered 'ftp.mysite.com' it will not redirect to 'www.ftp.mysite.com'. Very useful if you run a site that sources settings from a url to do multi-site management, like drupal.
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]