How to password protect Apache folders

Create .htpasswd file for users and passwords:

htpasswd -c /path/to/file/.htpasswd username
This command will prompt you for the password.

Edit .htaccess:

AuthName "Some text saying that the folder needs password, for example: enter password"
AuthType Basic
AuthUserFile /path/to/file/.htpasswd
require valid-user
deny from all







Got a comment?

captcha =

Categories

  1. System (20)
    1. FreeBSD (5)
    2. Linux (9)
  2. Email (2)
  3. DNS (2)
  4. Databases (1)
  5. WebServer (27)
 
Copyright © 2012-2015 HowToUnix - *nix Howtos and Tutorials
All Rights Reserved.