All pastes #45098 Raw Edit

megaspaz - htaccess

public text v1 · immutable
#45098 ·published 2006-03-10 06:45 UTC
rendered paste body
go into the directory you want to access protect. run the command:
touch .htaccess

then edit that file so it looks like:

AuthUserFile /full/path/to/directory_to_be_protected/.htpasswd
AuthName "Authorization Required"
AuthType Basic
require valid-user

that's what should be in the .htaccess file.

then use this command for setting up the password for the first user.

(22:17:03) megaspaz: then run this command in the same directory:

/path_to_apache_install/bin/htpasswd -c ./.htpasswd <username>

then you need to edit your httpd.conf file and add.

<Directory "/full/path/to/directory_to_be_protected">
  AllowOverride AuthConfig
  Options Indexes FollowSymLinks Includes
  Order allow,deny
  Allow from all
</Directory>

to add another user to an existing .htpasswd file, cd to the directory where the .htpasswd is and run:

/path_to_apache_install/bin/htpasswd ./.htpasswd <username>