How do I disable directory browsing? code example

Example 1: deny directory listing htaccess

# Place the following in your .htaccess at doc root
Options -Indexes

Example 2: How do I disable directory browsing?

This will disable directory listing from all folder that apache2 serves:

Open /etc/apache2/apache2.conf and change from this:


        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted


to this:


        Options FollowSymLinks
        AllowOverride None
        Require all granted


then restart apache by:
sudo service apache2 reload

Tags:

Misc Example