RewriteEngine On rewritecond %{http_host} ^yourdomain.com rewriteRule ^(.*) http://www.yourdomain.com/$1 [R=301,L]