FAQ Control Panel

How to turn directory listings on or off

What causes a folder to show a bare file listing, and how to turn that behaviour on or off deliberately.

Updated 4 min read Beginner

Directory browsing controls what a visitor sees when they reach a folder on your site that has no page of its own. With it off — the normal, safer setting — they get a 403 Forbidden or a 404, depending on configuration. With it on, they instead see a plain, unstyled listing of every file in that folder, each one a clickable link.

Why this happens at all

A web server, asked for a folder rather than a specific file, first checks for a default page such as index.html or index.php. If it finds one, that loads and directory browsing never comes into it. If it finds none, what happens next depends on whether directory browsing is switched on for that folder: on, and it lists the files; off, and it refuses the request instead.

Leaving it on is a real exposure, not a cosmetic issue

A folder with directory browsing on will show every file inside it to anyone who requests the URL directly — including files you may have uploaded and forgotten about, backup copies, configuration files, or anything else that happened to be sitting there. This is a genuine way sensitive files get found by people who were never supposed to see them, not just an untidy-looking page.

Turning it off

Directory browsing is switched off by default on most hosting setups, and stays off unless something has explicitly changed it — an inherited configuration, a setting changed by mistake, or leftover from a previous site on the same account. If you are seeing a raw file listing where you did not expect one:

  • Check the security or directory settings in your control panel for an option covering directory browsing or directory indexes, and confirm it is switched off for the folder in question.
  • Alternatively, add a line such as Options -Indexes to the .htaccess file in that folder, which explicitly disables listing for it regardless of the server's general setting.
  • Simplest of all: add a basic index.html or index.php file to the folder. With a default page present, the server never needs to fall back to a listing at all.

Turning it on, deliberately

There are a few legitimate uses — a folder of downloadable files meant to be browsed openly, for instance, where building a proper index page is not worth the effort. If you genuinely want this for one specific folder, the same tools apply in reverse: a control panel option to enable browsing for that folder, or Options +Indexes in an .htaccess file scoped to just that location. Keep it limited to the one folder that needs it rather than switching it on account-wide.

If a listing has already appeared somewhere you did not expect and you are not sure why, why your site shows a list of files covers the troubleshooting side of tracking down the cause.

Frequently asked questions

What is directory browsing?

It is what happens when a folder has no default page for the server to load and directory browsing is switched on: instead of a 403 or a 404, the visitor sees a plain, unstyled list of every file in that folder, each one clickable.

Should I turn it on or off?

Off, for almost every folder on a normal website. It is switched off by default for good reason — an open listing can expose files you never intended visitors to browse. Turn it on only for a specific folder that is genuinely meant to work as a simple public file index, such as a folder of downloadable resources with no page of its own.

Related reading