How to Prevent a Directory Listing of Your Website?

There are many times we create a website but forget that there are many people in the world who always like to find some loop holes in your website. If you do not prevent people from gaining access to your website, one of the first steps is to prevent them to list any directory. The easiest way to check is to open the folder of your website and see if you can all the files like a directory list.

There are two ways on how to prevent it.

  1. Create a blank index.html file for each folder
  2. Create or update the .htaccess file with the below line
    Options -Indexes