Publish - Apache Restricted Files

The .htaccess file is good for restricting access to files in the web survey directory. Some possible uses for the .htaccess file are:

This document will focus on setting up the .htaccess for use with EZSurvey.

Limit users access to a directory:
Create the .htaccess file:

A basic setup for the .htaccess file would look like this:

     AuthUserFile /usr/users/company/website/project/.htpasswd
     AuthGroupFile /dev/null
     AuthName "Restricted Directory"
     AuthType Basic

     <Limit GET POST>
     require valid-user
     </Limit>

A better setup for the .htaccess file would look like this

     DirectoryIndex ezs.cgi
     IndexIgnore *

     AuthType Basic
     AuthName "EZSurvey CGI"
     AuthUserFile /usr/users/company/website/project/.htpasswd

     <Files *.asc>
     require valid-user
     </Files>
     <Files *.xml>
     Require user admin
     </Files>
     <Files *.ini>
     order deny,allow
     deny from all
     </Files>
     <Files *.sum>
     order deny,allow
     deny from all
     </Files>
     <Files *.val>
     order deny,allow
     deny from all
     </Files>

The field AuthUserFile must be an absolute path to the .htpasswd file.

To create a new password file (where user_name is the name of a user) type this in at the command prompt:

     htpasswd -c .htpasswd user_name

To add a new name to the password file (where new_name is the name of a user) type this in at the command prompt:

     htpasswd .htpasswd new_name

See also...