title: Apache .htaccess redirect to HTTPS before asking for user authentication
body: <p>This is my .htaccess:</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
  
  AuthUserFile /etc/hi
  AuthName "hi"
  AuthType Basic
  require valid-user
  </code></pre>
  
  <p>It asks for user authentication using http, meaning that password will be sent in plain text. It will than redirect to the https version and ask the password again.</p>
  
  <p>How can i fix it?</p>