.htpasswd and .htaccess generator: .htaccess example



The .htaccess file is an ASCII file and can have several purposes, such as protecting your directories.

Example of an .htaccess file to protect a directory:

AuthUserFile /home/vhost/yourdomain.com/path/.htpasswd
AuthGroupFile /dev/null
AuthName "Restricted Access"
AuthType Basic
require valid-user


The .htaccess file is placed inside the protected directory.

If the webserver is running on a Windows environment the AuthUserFile will look like: C:/home/vhost/yourdomain.com/path/.htpasswd