This tip explains how to configure an access via htaccess. This allows password secured access to web directories.
We must add the following statement in Web Folders to protect:
Options Indexes Includes FollowSymlinks MultiViews
Allow from all
The AllowOverride AuthConfig primitives configure Apache to take into account the .htaccess file in the web directory and its subdirectories.
The .htaccess file
With a text editor create a .htaccess file under the directory to be protected, containing the following lines:
AuthName "protected access"
<Limit GET POST>
contains the logins and passwords.
Creatinf the .htpasswd file
To create the file. htpasswd file, simply run the command
# htpasswd -c /path/to/.htpasswd user
command is present in the bin directory of Apache, the -c
option creates the file, note that you must specify the user name and password to the application.
The file is created by the command, from there restart Apache.
Thanks to wjaouadi for this tip
Published by jak58
Latest update on December 9, 2009 at 03:58 AM by jak58.