#linux #debian #AIX #unix #www #http #https #ftp #htaccess #apache2 #systemctl #sudo
/etc/apache2/apache2.conf
1. Find the Options line within the Directory blockock.<Directory /var/www/mysite> Options Indexes FollowSymLinks </Directory>
2. Remove Indexes option or add -Indexes to Options directive.<Directory /var/www/mysite> Options -Indexes FollowSymLinks </Directory>
Notice that it's -Indexes and not +Indexes
Disable Apache directory listing using .htaccess
If you don't have root access or prefer to control directory listing for specific directories, utilize the .htaccess file:
1. Navigate to the directory where you want to disable directory listing.
2. Open or create .htaccess file on the directory using your preferred text editor.$ sudo vi /var/www/mysite/.htaccess
3. Add -Indexes to Options directive in the .htaccess file.Options -Indexes
$ sudo systemctl restart apache2
[[Install Apache WebServer]]