Install the Apache server.
Edit the Apache configuration file for the website.
Add the following lines to this configuration file.
Change the directory you want to protect.
Here is the file, before our configuration.
Here is the file, after our configuration.
Restart the Apache service.
As a test, create a directory without an index file.
Try to access the directory without the index file.
Here is the command output.
In our example, the directory listing feature was disabled on a directory.
From a remote computer, open the browser and try to access a directory of the Apache server.
The Apache server will deny access and display an error message.
Here is the result, before our configuration.
Here is the result, after our configuration.
Congratulations! You disabled the directory listing on the Apache server.