Deny directory listing with .htaccess

Share:
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
/public_html/ABCD/Test1/
/public_html/ABCD/Test1/Test/,
/public_html/ABCD/Test2/

You can see everything in that directory simply by typing "http://www.example.com/Directory_name/"

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  

3 comments:

  1. This is an awesome post. Really very informative and creative contents.
    WordPress website development company in Chennai

    ReplyDelete
    Replies
    1. IEEE Final Year Project centers make amazing deep learning final year projects ideas for final year students Final Year Projects for CSE to training and develop their deep learning experience and talents.

      IEEE Final Year projects Project Centers in India are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation.

      corporate training in chennai corporate training in chennai

      corporate training companies in india corporate training companies in india

      corporate training companies in chennai corporate training companies in chennai

      I have read your blog its very attractive and impressive. I like it your blog. Digital Marketing Company in Chennai Project Centers in Chennai

      Delete

Ads