<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www\.yoursite\.com [NC] RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301] </IfModule>