Apache Web Server Prevent Directory / Folder Listing

https‮.www//:‬lautturi.com
Apache Web Server Prevent Directory / Folder Listing

To prevent directory or folder listing in Apache web server, you can add the following line of code to the .htaccess file in the directory that you want to prevent listing for:

Options -Indexes

This will prevent directory listing for the directory in which the .htaccess file is located, as well as for any subdirectories under that directory.

Alternatively, you can also prevent directory listing by adding the following line of code to the httpd.conf file, which is typically located in the conf directory of your Apache installation:

<Directory /path/to/directory>
    Options -Indexes
</Directory>

This will prevent directory listing for the specified directory and all of its subdirectories. You will need to restart Apache for the changes to take effect.

Created Time:2017-10-16 14:38:36  Author:lautturi