This is a simple trick to hide all the Web directory listings from your site, so that visitors or any other people can’t view the contents of your site or exploit them to get access to your site. Hackers can use these directory listings and with some wrong permission set on folders or file they can use them to get access to your files and database or hack into your sites.
Many sites knowingly or unknowingly have their web directory listing open to visitors. These directories are also easily indexed on google for newbie hackers to look for something to exploit. So its best to hide your directory listing on your uploads or images directory. These type of directories can be easily found with google with a simple search term.
These web directory listings can be avoided easily with a single blank index.php file to the folder you want the listing hidden. So when a blank index.php is in place, the page would just show a white blank page that wouldn’t reveal any files in that directory. You can create a blank index.php file by creating a new text document in your system and renaming it to “index.php”. Then you can upload them through any FTP client to your server.
If you use a Web CMS like Cpanel to manage your sites, you can easily create a new file from the file manager and name it to index.php. This is how you secure your web directories from being open to everyone.