Forum Moderators: phranque
I want to restrict access to a directory of my website running on an Apache webserver and think that the use of the .htaccess and .htpasswd files are the way to do this, but I am having a problem getting them to work.
I have created the folder which I want to protect and put a .htaccess and .htpasswd file in the folder. The content of the .htaccess file is as follows:-
AuthUserFile .htpasswd
AuthGroupFile /dev/null
AuthName "Private Area"
AuthType Basic
<Limit GET POST>
require valid-user
</Limit>
Any advice on where I have gone wrong?
Cheers
Chris
The next-most likely problem is that the AuthUserFile path to .htpasswd needs to be the full server filepath to the .htpasswd file. You may have to ask your host what this path is.
Jim
Also, if you want to restrict access altogether, than you might want to review the Apache Module mod_access [httpd.apache.org].