How to enable and disable directory index listings using an .htaccess file?

To enable index listings for a directory add the following line to the .htaccess file:

Options +Indexes

This directive enables standard indexing, where the index listing shows only the filenames. You can also enable “fancy” indexing, where the index listing shows filenames, their filesizes, and when they were last modified. To do this, add the following line to the .htaccess file:

IndexOptions +FancyIndexing


To disable index listings for a directory add the following line to the .htaccess file:
Options -Indexes

If you wish to stop fancy indexing but keep normal indexing active, open the .htaccess file's IndexOptions line in a text editor and make the following changes:

IndexOptions -FancyIndexing
Was this answer helpful?

Related Articles

How to change HTTP headers using .htaccess files

This article shows how to edit the HTTP headers that Apache sends to a client directly....

How to protect a website folders using .htaccess

The .htaccess file is a configuration file used by Apache-based web servers. Directives in...

How to use an .htaccess file to alter the default directory index page?

On HostGinger Hosting servers, by default, when users access a URL that requests a directory,...

What is .htaccess files?

An .htaccess file is a plain-text configuration file that you can use to alter the settings of...

How to protect .htaccess file contents?

By default, everybody has access to an .htaccess file's contents. Due to the fact that it exposes...