Disable directory (folder) browsing in apache server

Security reason, we shouldn't allowed directory (folder) access via browser, so, in order to disable directory (folder) browsing in apache server, please make some changes as follow:

apache2 conf

1. Open apache2.conf under file path via ftp client



using command:

$ nano /etc/apache2/apache2.conf

2. Search these keywords

Options Indexes FollowSymLinks

apache2 conf

Copy this line and comment on it by adding # sign the start of the line. Then paste it below and remove "Indexes" from the line as like below and SAVE it.

Options FollowSymLinks

The final will be look like this:

<Directory /var/www/>
#Options Indexes FollowSymLinks
Options FollowSymLinks
AllowOverride None
Require all granted

3. Finally we need to restart apache2 service to apply the changes via command line:

$ systemctl restart apache2.service

directory browsing disabled

Now, directory browsing is disabled and if you are trying to access the folder (Directory), you should be seeing a "Not Found" message.

Your link is almost ready.

Please wait...