Password protect directory with htaccess
AuthName "Members Area"
AuthType Basic
AuthUserFile /path/to/your/directory/.htpasswd
require valid-user
chmod it to 755
NOTE: you can also have require user tom dick harry
Note: The .htpasswd file can be /etc/passwd
We then need to create the .htpasswd file;
htpasswd -c .htpasswd your-user-name
chmod it to 644
TO BE VERIFIED
Preventing indexes
Create a .htaccess file in the folder you with to protect with the following:
Options -Indexes
chmod it to 755
Options -Indexes
chmod it to 755
The http.conf file can also be modified, finding Options.
The example below shows the configuration for all www.* websites on one of my servers and in this case allows indexes but the word Indexes can simply be removed;
<Directory "/var/www/www.*">
Options Indexes FollowSymLinks
AllowOverride AuthConfig
Require all granted
</Directory>
No comments:
Post a Comment
Note: only a member of this blog may post a comment.