title: Redirect non WWW to WWW using htaccess without failing subdomains
body: <p>I need to redirect non WWW to WWW without failing sub domains. Please help me to do this. </p>
  
  <pre><code>mydomain.com &gt; www.mydomain.com
  m.mydomain.com &gt; m.mydomain.com
  mydomain.com/page.php &gt; www.mydomain.com/page.php
  </code></pre>
  
  <p>I am using URL rewrite. they should also remain working. 
  This is the current htaccess file.</p>
  
  <pre><code>Options All -Indexes
  RewriteEngine On # Turn on the rewriting engine
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteCond %{HTTP_HOST} ^([a-z.]+)$ [NC]
  RewriteRule ^/(.*)$ http://www.%1/$1 [R=301,L]
  RewriteRule ^vid vid.php [NC,L] 
  AddType application/octet-stream mp3 
  RewriteCond %{HTTPS} =on 
  </code></pre>
  
  <p>Thank you.</p>