title: Directory protection asking for password twice on my https website?
body: <p>I am trying to protect my website with a directory protection code. The website is in PHP.</p>
  
  <p>My website has https and it is like <a href="https://www.example.com" rel="nofollow">https://www.example.com</a>.</p>
  
  <p>When I Open the website it is asking for username and password twice. I think it is taking once for http and once for https.</p>
  
  <p>Can anyone please help me how to solve this problem.</p>
  
  <p>Below is my <code>.htaccess file code</code></p>
  
  <pre>
  options -multiviews
  &lt;IfModule mod_rewrite.c>
  RewriteEngine On 
  RewriteBase /
  RewriteCond %{HTTP_HOST} ^example.com$ [NC,OR]
  RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
  RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
  &lt;/IfModule>
  
  AuthType Basic
  AuthName "example.com"
  AuthUserFile /www.example.com/web/content/.htpasswd
  Require valid-user
  
  &lt;IfModule mod_security.c> 
     # Turn off mod_security filtering. 
     SecFilterEngine Off 
     # The below probably isn't needed, 
     # but better safe than sorry. 
     SecFilterScanPOST Off 
  &lt;/IfModule>
  </pre>
  
  <p>Thanks in advance for any help.</p>