If a directory on your website doesn’t have an index page, then by default it’ll present the user with a directory listing. This isn’t usually a good thing, especially if it’s an image directory. You can prevent this from happening by modifying your .htaccess file (or creating it if you don’t have one).

Open your .htaccess file in notepad (or create one) and put:

IndexIgnore *

The * is a wildcard that matches everything, so if you put this in your htaccess file in your images directory, nothing in that directory will be listed.

If you want the directory contents to be listed, but ignoring certain files, you can:

IndexIgnore *.gif *.jpg

This will ignore all .gif and .jpg files in the directory, but list everything else.

Alternatively, if you want to blanket block all directory listing from all directories on your website, simply put the following in a .htaccess file in the root of your website (usually public_html):

Options -Indexes

… and lastly, if your web server already blocks directory listing by default (some apache webservers have this configured by default), but you want to enable directory listing for a particular directory, stick this in the .htaccess in the directory:

Options +Indexes