Knowledgebase Home / How to Disable Directory Listing in cPanel
// View Comments //

How to Disable Directory Listing in cPanel

If you’ve ever visited a URL that leads to a directory that does not have an index file, you’ve probably seen a list of the files in the directory. This means indexing is turned on for that online folder.

This is the default configuration for most web servers. In most cases, though, we don’t want to display the contents of a directory. Leaving files publicly visible is a security and privacy risk.

In this tutorial, we will show you how to disable directory listing using cPanel.

There are several ways to turn off directory indexing using cPanel. We’ll start with configuring the indexes directly.

Quick steps

  1. Log in to cPanel.
  2. In the “Advanced” section, click the Indexes link or icon.
  3. To configure a directory to turn indexing on or off click the EDIT button.
  4. Select No Indexing and click Save

Disable Directory Listing in cPanel

Log in to cPanel. In the “Advanced” section, click the “Indexes” link or icon.

Indexing option in cPanel interface

Indexing option in cPanel interface

You’ll see the directory structure for your website.

To enter a directory, click the folder icon.

Indexing option in cPanel interface

Indexing option in cPanel interface

In this tutorial, we’re going to turn indexing off for only one directory. So we’ll click the folder icon for public_html/test.

Once we’re in the public_html directory, we’ll click the EDIT button of the directory test where we want to turn off indexing.

Indexing option in cPanel interface

Indexing option in cPanel interface

Select the No Indexing option and click the Save button.

Indexing option in cPanel interface

Indexing option in cPanel interface

The other available options

Inherit

Select this mode to use the parent directory’s setting. If the index settings are not defined in the parent directory, the system will use its default settings.

No Indexing

No files will appear in this directory if a default file is missing.

Show Filename Only

This mode shows a simple list of the files present if the default file is missing.

Show Filename and Description

This mode shows a list of files and their attributes: file size and file type.

The success message should say, “…indexes are now: Off”

Indexes option in cPanel

Indexes option in cPanel

Using cPanel File Manager to Disable Directory Listing in cPanel

Our destination here is the same as the previous method, but we’re taking a different route to get there. If you work in the cPanel File Manager a lot, you may prefer this method.

In the Files section of cPanel, click the File Manager link or icon.

File Manager option in cPanel

File Manager option in cPanel

You want the directory name to be in the right panel. So for our example, we click public_html in the left pane to get our demo directory listed on the right.

Click the directory name to select it, then right-click. Mac users may use CMD+click to open this list.

From the drop-down menu, select Manage Indices.

File Manager option in cPanel

File Manager option in cPanel

Now we’re back at the same Indexes page that we saw in the first method.

Select the No Indexing option and click the Save button.

Indexes option in cPanel

Indexes option in cPanel

Conclusion

You learned How to Disable Directory Listing in cPanel.


If you have any web hosting questions please feel free to reach out to us. We're happy to help.
Shared Hosting | Reseller Hosting | Managed WordPress Hosting | Fully Managed VPS Hosting

Our Guiding Principles

  • Provide consistent, stable, and reliable web hosting services.
  • Ensure rapid ticket response and quick resolutions to issues.
  • Never saturate or over-provision servers to ensure stability and speed for our customers.
  • Use only high-quality enterprise-class hardware to ensure minimal downtime from hardware failures.
  • Provide clear pricing with no hidden fees or gotchas.
Subscribe to comment notifications
Notify of
guest
0 Comments
Inline Feedbacks
View all comments