Complete setup for htaccess
Install below
sudo apt-get install apache2-utils
Modify the file below
/etc/apache2/apache2.conf
sudo apt-get install apache2-utils
Modify the file below
/etc/apache2/apache2.conf
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Add the file .htaccess to any folders you wish to password protect insert the code below
AuthName "Login message here"
AuthType Basic
AuthUserFile /path/to/password/file/.htpasswd
require valid-user
create the /path/to/password/file/.htpasswd (keep it out of the web directory)
add users with the following command
sudo htpasswd /path/to/password/file/.htpasswd new_user
Dont forget to restart Apache2 when finished.
/var/log/apache2/error.log look here for issues first
ReplyDeleteyou cannot use a relative path in the .htaccess file you must use the absolute path
ReplyDelete