Im creating a simple private page with links to some files to download. I\'ve done it with simple session management but I have a problem: if somebody click on the file-url he c
Here is a very simple solution using htpasswd (quick and easy and it works).
$ cd /path/to/password_protected_dir
$ vi .htaccess
Then within your .htaccess file you will need to add this:
AuthUserFile /path/to/.htpasswd
AuthGroupFile /dev/null
AuthName "My Private Directory"
AuthType Basic
require valid-user
Next you will generate the .htpasswd file which you just included in the .htaccess file as show above. You can do this like so:
$ htpasswd -c .htpasswd user_name
At this point you will be prompted to enter the password.
Of course, this is merely one method of accomplishing this.