Disable or Enable Directory Browsing or Indexing

How to disable directories from browsing or indexing to hide images, and other files from visitors. This give you total control of your web folders to block unwanted viewing using .htaccess files with Apache

Disable or Enable Directory Browsing or Indexing in .htaccess file

Browsing or indexing is an option that allows the contents of a directory to be displayed in the browser when the directory does not contain an index page.

For example, if you make an http call to a directory such as http://yourdomain.com/images/, it would list all the images in that directory without the need for an html page with links.

We will need to create a blank file called “.htaccess”. You can name it “htaccess.txt” while your editing it, then rename the file to “.htaccess” after the file is on your web server.

Disable Directory Browsing or Indexing

Type or copy and past the following line of text in to your blank file.
Note: I add the work “All” so that every folder in that directory follows the same rule.

Options All -Indexes

Enable Directory Browsing or Indexing

You can reactivate it by adding the following line to your .htaccess file:

Options +Indexes

Once this is added, the directory will fully index again.

Tagged : / / / / / / / / / / / /

5 thoughts on “Disable or Enable Directory Browsing or Indexing

  1. Just browsed your site. The .htaccess file enables directory browsing, a critical element in doing fast map download/redirects for half-life based games!! I just enabled it and immediately maps began downloading at blazing speeds. Thanks a lot!!

  2. hi.. i m gaurav from hackersfind.com

    sir i want to know that how to prevent wordpress sites from being hacked because last day my website has been hacked by a hacker and i wanna to knw the issue why the site has been hacked and wanna to close all loop holes in my site

Leave a Reply

Your email address will not be published. Required fields are marked *