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
- Log in to cPanel.
- In the “Advanced” section, click the Indexes link or icon.
- To configure a directory to turn indexing on or off click the EDIT button.
- 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.
You’ll see the directory structure for your website.
To enter a directory, click the folder icon.
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.
Select the No Indexing option and click the Save button.
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”
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.
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.
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.
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.