Here is some code that will allow you to make all requests to your site have "www" in front of it.
All sites we host by default can be accessed with and without the www, but some of you would like "www" only style urls.
Code:
RewriteEngine On RewriteCond %{HTTP_HOST} ^yourdomain.com RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]
In Apache 2.x you might try:
Code:
RewriteEngine On RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com$ RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]