How to stop file listing on your site (Indexes, cPanel)

If a site folder has no index.php or index.html, the server may show a list of all files in it - an "Index of /..." page. Strangers can then see backups, uploads and service files. On our hosting the file list is off by default; if your site still shows "Index of", close it as described below.

  1. Open "Indexes" (group "Advanced").
  2. Click "EDIT" next to public_html (or the folder of the site).
Choosing the folder
Choosing the folder
  1. Choose "No Indexing".
  2. Click "Save".
Disabling the file list
Disabling the file list

The setting applies to this folder and all subfolders set to "Inherit". Instead of the file list the visitor gets a 403 error.

With .htaccess

Options -Indexes

Add this line to .htaccess in the site folder - same effect.

WordPress and other CMS put empty index.php files in their folders, but upload and backup folders often lack them. Disabling listing at public_html closes everything at once.

If you need the file list

For example, for a downloads folder: choose "Show Filename Only" or "Show Filename and Description" for it - or add Options +Indexes to its .htaccess. Other folders stay closed.

Questions and answers
In "Indexes", set public_html to "No Indexing" or add Options -Indexes to .htaccess.