title: Redirect http to https and then redirect it to subdomain's folder?
body: <p>First case:</p>
  
  <p>I tried to redirect http to https and following rule works well.</p>
  
  <p>For example: <strong><a href="http://subdomain.domain.com" rel="nofollow">http://subdomain.domain.com</a></strong> to <strong><a href="https://subdomain.domain.com" rel="nofollow">https://subdomain.domain.com</a></strong>. </p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
  </code></pre>
  
  <p>Second Case:
  I tried to redirect <strong><a href="http://subdomain.domain.com" rel="nofollow">http://subdomain.domain.com</a></strong> to <strong><a href="http://subdomain.domain/folder" rel="nofollow">http://subdomain.domain/folder</a></strong>. For this I used this rule:</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{HTTP_HOST} ^subdomain\.domain\.com  
  RewriteRule ^(.*)$ /folder/$1
  </code></pre>
  
  <p>I want these redirection:</p>
  
  <p><strong><a href="http://subdomain.domain.com" rel="nofollow">http://subdomain.domain.com</a></strong> to <strong><a href="https://subdomain.domain.com/folder" rel="nofollow">https://subdomain.domain.com/folder</a></strong></p>
  
  <p>and</p>
  
  <p><strong><a href="https://subdomain.domain.com" rel="nofollow">https://subdomain.domain.com</a></strong> to <strong><a href="https://subdomain.domain.com/folder" rel="nofollow">https://subdomain.domain.com/folder</a></strong></p>
  
  <p>I tried merging the above rules but no luck.</p>
  
  <p>One more thing, I am not using <code>.htaccess</code> ,instead I put these rules to 
  <code>/etc/apache2/sites-available/default</code>.</p>