title: .htaccess mod_rewrite for https://subdomain.domain.com to https://www.subdomain.domain.com
body: <p>I'm using the following <code>mod_rewrite</code> in <code>.htaccess</code> file for redirecting my domain permanently</p>
  
  <p>from </p>
  
  <p><a href="https://domain.com" rel="nofollow">https://domain.com</a> </p>
  
  <p>to </p>
  
  <p><a href="https://www.domain.com" rel="nofollow">https://www.domain.com</a> </p>
  
  <pre><code>RewriteCond %{HTTPS} off
  RewriteCond %{HTTP_HOST} !^www\.
  RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  </code></pre>
  
  <p>How should I mod_rewrite for redirecting my sub-domain </p>
  
  <p>from</p>
  
  <p><a href="https://subdomain.domain.com" rel="nofollow">https://subdomain.domain.com</a> </p>
  
  <p>to </p>
  
  <p><a href="https://www.subdomain.domain.com" rel="nofollow">https://www.subdomain.domain.com</a></p>
  
  <p>I mean how can I redirect 3rd level domain from <code>https://</code> to <code>https://www.</code> using .htaccess mod_rewrite?</p>
  
  <p>Thanks,</p>