Skip to main content

How to Configure Directory Index Browsing

You can enable or disable the directory index feature to control whether a list of files is displayed when a user visits a directory without an index file. This is performed within the cPanel interface for your specific account.

You can enable or disable the directory index feature to control whether a list of files is displayed when a user visits a directory without an index file. This is performed within the cPanel interface for your specific account.

Before you begin

You will need:

  • A cPanel account with the appropriate permissions to manage website settings.

Configure Directory Indexing

  1. Log in to your cPanel account.

  2. Locate the Files section and select Index Options.

  3. Select the domain or subdomain you wish to modify from the list.

  4. Choose your preferred indexing behavior:

    • Options: Select No Index to prevent the server from displaying a list of files.

    • Options: Select Index to allow the server to display a list of files.

  5. Click Save.

Note: If you choose to disable indexing, the server will typically display a "403 Forbidden" error or a custom error page if a valid index file (such as index.html or index.php) is not found in that directory.

Confirm the result

  • Navigate to a directory on your website that does not contain an index file (e.g., example.com/images/).

  • If you selected No Index, the server should return a 403 Forbidden error or your custom error page.

  • If you selected Index, the server should display a list of files within that directory.

Troubleshooting

I see a list of files even though I selected "No Index"

If a directory index is still visible after selecting No Index, the server may be honoring a local configuration file. Check the directory for files named .htaccess or .ht_access and ensure they do not contain rules that override the global index settings.

I see a 403 Forbidden error even though I selected "Index"

A 403 Forbidden error usually indicates that the server cannot find a valid index file or the permissions on the folder are incorrect. Ensure your directory contains a file named index.html, index.php, or index.htm.

Did this answer your question?