- Setup a basic Apache build with document root set to /htdocs/
- Create the folder you want to protect under /htdocs/ - for example /htdocs/secret/
- Create a text file in your 'secret' folder called - '.htaccess' (no quotes)
- Populate this file with the settings (directives) that you want you 'secret' folder to have, in this case:
AuthType Basic
AuthName "Secret Web"
AuthUserFile /srv/www/.htpasswd
Require valid-user
- Now create a text file called '.htpasswd' (again no quotes) in /srv/www or somewhere other than your Apache document root
- Edit this and using a password encryption generation tool (http://www.tools.dynamicdrive.com/password/) create a username/password combination. It will look something like this:
If you now try to access your 'secret' URL you will be prompted for your username and password.
No comments:
Post a Comment