title: Preserve HTTP/HTTPS protocol in .htaccess redirects
body: <p>I have to redirect port 80 to 2368 in htaccess but I'd like to keep the requested protocol intact so that SSL doesn't break.</p>
  
  <p>I currently have this:</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} ^sub.domain.com$ [NC]
  RewriteRule ^ http://sub.domain.com:2368%{REQUEST_URI} [P,QSA,L]
  </code></pre>
  
  <p>which works correctly but I'd like the protocol to be taken from the %{HTTP_HOST} condition if possible.</p>
  
  <p>Is there a way to get this to be more dynamic without hard coding domains and protocols?</p>
  
  <p>It seems very slow as is.</p>