When any user comes to the website and if your default page like index.html, index.php not found then webserver will list out all the directories and files to the webpage.
Here is the snippet which disable the directory listing to the web page. Below code will produce 403 error if no default page is found.
Also we can disable specific files to be listed on the web page. Suppose if you don’t want to list out the .zip and .txt file.
Below code will not list .zip and .txt file and rest of all files will be listed.
Note: We can setup the default file access using “DirectoryIndex” directive.
Avinash Zala is leading various projects which deals with the various technology involved with the web. A combination of perfect technical and management skills. Avinash would like to chat with you and convert your imagination into the working system. You can get in touch with him on Facebook and Twitter.
View all posts by: Avinash