If you run a website that uses Apache then there is a 100% chance theat your public directories are openly accesible and anyone on the internet could gain access tot them and thereby get access to your backend code.
This is not a good thing and each and every website owner should take it seriously and make sure that directory lisging is disabled on their website.
How to disable it?
To disable the directory listing you just need to make few changes.
Within just 1 minute of making these changes your all directories will be made private and hidden and the access will be forbidden to these directory.
Follow the steps below to Turn off the directory listing.
1.Go to your Cpanel or any other Webhosting management program panel.
2.Next you should open the filemanger and navigate to the domain where you want to disable directory listing.Make sure that view hidden files is turned on so that you can view the hidden file which we need to edit.
3.Afyer you have turned on hidden files you should be able to see a file named .htaccess.
We just need to add a line to this file.
Edit this file and Add This line of code.
That’s all you are good to go now and your directories are now private and no one with unauthorised acces should be able to browse them.
Thanks for reading!