How to disable directory listing with Indexes in cPanel
Directory listing appears when a site folder does not have a main file such as index.php or index.html and the server shows an Index of page with the available files. In cPanel, you can use Indexes to block that listing without editing files manually.
This setting is useful for folders with downloads, temporary backups, images, or application subfolders where you do not want a visitor to see file names by accident.
Before you start
- Have cPanel access for the account where the domain is hosted.
- Identify the exact folder you want to protect, for example
public_html,public_html/downloads, or a subdomain folder. - Check whether that folder needs to show a public index; if it is an intentional gallery or listing, do not change the setting without confirming it.
- If a
.htaccessfile already exists, avoid editing it by hand during this review so you do not mix changes.
Choose the correct folder
- Log in to cPanel and search for Indexes. If your panel is in Spanish, it may appear as Índices.
- Open the tool and browse the folder tree until you reach the path you want to review.
- Click the folder name, not the folder icon if cPanel only uses the icon to expand subfolders.
- Confirm that the path matches the affected domain before saving any change.
If you are not sure about the path, open File Manager in another tab and compare the folder with the domain or subdomain you are testing.
Disable directory listing
- Inside the selected folder, choose No Indexing or the equivalent Sin indexación option.
- Save the change with Save or Guardar.
- Wait for the cPanel confirmation before leaving the screen.
- Repeat the setting in subfolders only if they can also be exposed; do not assume every folder needs the same behavior.
With No Indexing, the server stops showing the automatic file list when the folder does not have an index file.
Verify the result
- Open a private browser window.
- Visit the exact folder URL, for example
https://yourdomain.com/downloads/. - Confirm that an Index of page with file names no longer appears.
- Check a normal site page to validate that the change did not affect public content.
If the URL shows a 403 error, the listing is blocked. If you need that path to show a friendly page, create an index.html or index.php file inside the folder.
Common errors
- Index of still appears → you changed a different folder → review the full path in Indexes and compare it with the URL you are opening.
- The site shows 403 in a public section → that folder needed to list files or have an
indexfile → create anindex.htmlpage or revert the setting for that path. - The change does not appear immediately → the browser or a CDN keeps an earlier version → test in a private window and clear cache if needed.
When to use File Manager or .htaccess
Use File Manager if you need to create an index.html file, move sensitive files outside public_html, or check whether the folder contains backups that should not be published.
Use .htaccess only if you need a more specific rule or support asks you to validate an existing directive. For simple listing blocks, Indexes is usually safer because cPanel writes the setting for you.
Recommended reading
Still need help?
If this guide didn’t solve your issue, our team can help you via ticket.