.htaccess does not ask the password
Solution 1:
I suspect that the apache
user isn't capable of reading /home/janeb/.htpasswd
. Check Apache's error log.
That's the only thing I see wrong in the config that's provided, but that might not be the only problem; please provide your full virtual host config. I'd also recommend that you move the authentication config out of the .htaccess
file - there's no reason for it to be there.
EDIT:
The reason the .htaccess
file isn't being applied is because AllowOverride All
isn't being applied to the path where your .htaccess
file resides.
The .htaccess
file needs to be applied at the same time as the <Directory>
blocks - if AllowOverride
is specified in a <Directory ~ ...>
block then it happens after .htaccess
should have been applied. Since that doesn't work, the documentation specifically warns against it:
AllowOverride is valid only in
<Directory>
sections specified without regular expressions, not in<Location>
,<DirectoryMatch>
or<Files>
sections.
Add a new block to your config to allow your .htaccess
files to be used:
<Directory /home>
AllowOverride All
</Directory>
Solution 2:
By the looks of your config you likely need to put your .htaccess file under the /home/janeb/public_html
directory which is the DocumentRoot
if I'm not wrong.
Solution 3:
What are you trying to do exactly?
In your vhost
declaration ...
order allow,deny
allow from all
You've already stated that everyone should have access ... this would mean your following .htpasswd
is irrelevant, as its taking precedence.
Instead, remove that code, and in your .htaccess
all you need is ...
AuthType Basic
AuthName "Password Required"
AuthUserFile /home/janeb/.htpasswd
Require valid-user
The .htpasswd
file can be anywhere on the server as long as its readable by whoever Apache runs as (typically www-data).
If you want to combine IP restriction and .htpasswd
restriction, then you can also use ..
order deny,allow
deny from all
allow from 192.168.0.10
AuthType Basic
AuthName "Password Required"
AuthUserFile /home/janeb/.htpasswd
Require valid-user
Satisfy Any