I have a private homepage and I want to password-protect it using .htaccess. This is what my .htaccess file looks like:
AuthName MySiteAuthType BasicAuthUserFile /what/ever/.htpasswdrequire valid-user#making embeded videos work in wordpress<Files ~ "\.(mp4|m4v)">AddType video/mp4 .mp4 .m4vorder allow,denyallow from allsatisfy any</Files># Code for Wordpress<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /whatever/RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /whatever/index.php [L]</IfModule>#End WordpressOptions -Indexes
It's located in the folder directory directed for the homepage.
Problem is that when accessing the server via it's subdomain the browser keeps asking for login/pass. If pressing cancel after two atempts one is directed to the page anyway.
If trying to access the webpage without subdomain, like this: www.mypage.com/privatesite, the browser asks for password once and then it's done. No problems.
This is the homepages .conf file in apache:
<VirtualHost *:80>ServerName my.site.comServerAlias www.my.site.comServerAdmin webmaster@site.seDocumentRoot /var/www/html/siteAccessFileName .htaccess<Directory "/var/www/html/site">AllowOverride AllOrder allow,denyAllow from allRequire all granted</Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined</VirtualHost>