I am trying to protect my website with a directory protection code. The website is in PHP.
My website has https and it is like https://www.example.com.
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.
Can anyone please help me how to solve this problem.
Below is my .htaccess file code
options -multiviews
<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]
</IfModule>
AuthType Basic
AuthName "example.com"
AuthUserFile /www.example.com/web/content/.htpasswd
Require valid-user
<IfModule mod_security.c>
# Turn off mod_security filtering.
SecFilterEngine Off
# The below probably isn't needed,
# but better safe than sorry.
SecFilterScanPOST Off
</IfModule>
Thanks in advance for any help.