If your files are not protected then one must think over the protection of the file. Protection can be provided in various ways like PHP login page, but it will not protect your documents, images and other media. We can protect the files using .htaccess protection. The system requires two files -- the .htaccess file and .htpasswd file.
.htaccess Code
AuthType Basic
AuthName "restricted area"
AuthUserFile /home/gaurav/html/lavaneur/.htpasswd
require valid-user
The code written above protect "lavaneur" directory at root level. The "AuthUserFile" value is always specific to your hosting configuration. If you don't know what the value should be, do a phpinfo() and find the DOCUMENT_ROOT value.
.htpasswd Code
gaurav:sw8zx1s6eXs saurabh:aq2dc$NdcPmB vaibhav:LM7Yt%ddOItThe .htpasswd file contains the usernames and passwords of allowed users. One per line.
No comments:
Post a Comment