title: redirecting only non-www to www - ignoring all subdomains
body: <p>I am surprised that Googling this did not return any useful solution to my problem.</p>
  
  <p>I want to redirect only non-www requests to www.. but if it's a subdomain, I want it to ignore it.</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{HTTP_HOST} ^domain.com [NC] 
  RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
  </code></pre>
  
  <p>This redirects non-www to www, but if I enter a subdomain it appends a "www." in front of it.. I need to stop this behavior.</p>