Apache - Password protect a Directory


/ Published in: Apache
Save to your folder(s)



Copy this code and paste it in your HTML
  1. cd /this/dir/is/secure
  2.  
  3. ### create .htpasswd
  4. htpasswd -c .htpasswd user1
  5.  
  6. ### add a new user
  7. htpasswd .htpasswd user2
  8.  
  9. ### .htaccess
  10. AuthUserFile .htpasswd
  11. AuthName "Ric's protected files"
  12. AuthType Basic

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.