.htaccess and .htpasswd
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 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
require user admin
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:
AuthName "Login Area"
<Limit GET POST>
require user admin
Safe the '.htaccess' file into any folder you want to be password-protected
and set permissions to '644'.
Hope that works for you.
If you keep on that trouble, use only server-side validation with PHP.
I use this, it makes it easy.
hey azuremain, thanks for your help, but one question do I set the permissions to the folder or the file?
Originally Posted by azuremain
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)