Deny directory listing with .htaccess

Deny directory listing with .htaccess

If you make a new directory on your website, and do not want put an "index.html" file into it, you may be surprised to find that your visitors can get a directory listing of all the files in that folder.
For Example:

I have a directory /public_html/ABCD/

And too many sub directories into it, like

You can see everything in that directory simply by typing ""

This article show you how you can configure your web server so that it does not show a directory listing by default.

Add the following line to your .htaccess file.

 Options -Indexes  

If you want to enable it,

 Options +Indexes  

If we want that some particular extension will not show than.

 IndexIgnore *.zip *.css *.json *.pdf  

If we want to index our files and showing it with some information than use.

 IndexOptions -FancyIndexing  

No comments

'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + ''; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();