Protect a web directory with password

vim /path/of/your/dir/.htaccess

Paste this into:

AuthType Basic
AuthName "Private Dir"
AuthUserFile /path/of/your/dir/.htpasswd
require valid-user

Then we must create the password file /path/of/your/dir/.htpasswd.

We want to log in with the username “user”, so we do this:

htpasswd -c /path/of/your/dir/.htpasswd user

Enter a password for “user”, and you’re done!

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)