I'm having some trouble with this. I believe I stored the files and changed the permissions properly, but access is still given to all. This is what I did:
Create a .htpasswd file with the generated password,
i.e. admin:9tt7mvJ3Q7Ceo
I stored this file in a directory that I will specify in a .htaccess file
I then created the .htaccess file within the protected directory.
i.e. AuthUserFile /absolutepath/.htpasswd
AuthGroupFile /dev/null
AuthName test
AuthType Basic
<Limit GET>
require user admin
</Limit>
Btw, I'm using UNIX, and I did chmod 644 to the .htaccess and .htpasswd files and then a chmod 711 to both directories individually(wasn't sure which one to do it to). I did them independently too, by creating a new directory and not using the one that had already permissions set.
Can anyone point out anything that I may be doing incorrectly.
I am suprised nobody replied so far as this is a rather simple function for a website.
Here is how to setup this feature:
a) '.htpassword' file:
The structure of your file '.htpassword' file looks okey, although
of course I don't know your password.
Assuming you encrypted the admin password correctly, then safe the '.htpassword' file into a folder called 'data' in your root directory
(e.g. '/home/yourrootdirectory/data/.htpasswd') and set permissions to '644'.
b) '.htaccess' file:
The content of your '.htaccess' file should follow this format:
AuthType Basic
AuthName "Login Area"
AuthUserFile /home/yourrootdirectory/data/.htpasswd
<Limit GET POST>
require user admin
</Limit>
Safe the '.htaccess' file into any folder you want to be password-protected
and set permissions to '644'.
hey azuremain, thanks for your help, but one question do I set the permissions to the folder or the file?
Originally Posted by azuremain
Hello jeeva86,
I am suprised nobody replied so far as this is a rather simple function for a website.
Here is how to setup this feature:
a) '.htpassword' file:
The structure of your file '.htpassword' file looks okey, although
of course I don't know your password.
Assuming you encrypted the admin password correctly, then safe the '.htpassword' file into a folder called 'data' in your root directory
(e.g. '/home/yourrootdirectory/data/.htpasswd') and set permissions to '644'.
b) '.htaccess' file:
The content of your '.htaccess' file should follow this format:
AuthType Basic
AuthName "Login Area"
AuthUserFile /home/yourrootdirectory/data/.htpasswd
<Limit GET POST>
require user admin
</Limit>
Safe the '.htaccess' file into any folder you want to be password-protected
and set permissions to '644'.
Bookmarks