title: http to https redirection not working while accessing admin area which pretected by htpassword
body: <p>I have used below code to redirect from http to https &amp; www to non www. </p>
  
  <pre><code>RewriteEngine on
  
  RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
  RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
  
  RewriteCond %{HTTPS} !on
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  </code></pre>
  
  <p>And inside admin directory I have used below code to password protect admin directory. </p>
  
  <pre><code>AuthType Basic
  AuthName "Password Protected Area"
  AuthUserFile /path/public_html/admin/.htpasswd
  Require valid-user
  </code></pre>
  
  <p>While accessing the admin using https mode like below</p>
  
  <pre><code>https:://example.com/admin
  </code></pre>
  
  <p>Its working fine but while accessing with http mode instead of redirecting its redirecting to an error page</p>
  
  <pre><code>http:://example.com/admin
  </code></pre>
  
  <p>Thank You.</p>