How to Disable Directory Listing in cPanel

  WHM

Introduction

Directory listing allows visitors to view the files and folders inside a website directory when there is no default index file such as index.html, index.php, or default.html. If directory listing is enabled, sensitive files may become publicly visible, which can create security and privacy risks.

To prevent this, directory listing should be disabled in cPanel.

Prerequisites

Before starting, make sure you have:

  1. Valid cPanel login credentials.
  2. Access to the website’s document root directory, usually public_html.
  3. Permission to modify directory settings in cPanel.

Method 1: Disable Directory Listing Using cPanel Indexes

Step 1: Log in to cPanel

Log in to your cPanel account using your valid username and password.

Step 2: Open Indexes

In the cPanel dashboard, go to the Advanced section and click Indexes.

Step 3: Select the Directory

The website directory structure will be displayed. Click the Edit option for the directory where you want to disable indexing.

For most websites, the document root directory is usually:

public_html

Step 4: Choose No Indexing

Select the No Indexing option.

Step 5: Save the Changes

Click the Save button to apply the changes.

Step 6: Verify the Success Message

Once saved, cPanel will display a success message confirming that directory listing has been disabled.


Method 2: Disable Directory Listing Using cPanel File Manager

Step 1: Open File Manager

Log in to cPanel and go to the Files section. Click File Manager.

Step 2: Select the Directory

In the left-side panel, right-click the directory where you want to disable indexing.

Example:

public_html

Step 3: Click Manage Indices

From the drop-down menu, select Manage Indices.

Step 4: Select No Indexing

The Indexes settings page will open. Select the No Indexing option.

Step 5: Save the Changes

Click the Save button.

Step 6: Confirm the Update

A success message will be displayed, confirming that directory listing has been disabled for the selected directory.


Conclusion

Disabling directory listing in cPanel helps protect website files from being publicly visible. It is a simple but important security step. By selecting No Indexing for your website directory, you can prevent unauthorized users from browsing files and folders directly through the browser.

LEAVE A COMMENT