Sometimes it’s useful to enable files and directory listing (or indexing) to allow users viewing and downloading all the files within a directory.
To enable this feature just add or change the corresponding portion of the Apache configuration. The configuration file is usually
Options Indexes FollowSymLinks MultiViews
Require all granted
The outcome is showed below:
If you like to password protect a directory on your web server, just create a
.htaccess file into such a directory and put the following code:
AuthName "Restricted Area"
Then, generate the corresponding
.htpasswd file by executing the following command:
/path/directory/protect$ htpasswd -c .htpasswd admin
Re-type new password:
Adding password for user admin
Reload your web directory and enter the credentials you’ve just chosen.