Short answer: Open cPanel Indexes, select your web root directory, and set indexing policy to 'No Indexing' to prevent public directory browsing of your site files.
Prevent unauthorized directory file browsing for folders lacking default index pages to shield code assets and confidential media.
Quick reference
| Tool Location | cPanel > Advanced > Indexes |
|---|---|
| Recommended Mode | No Indexing (Yields 403 Forbidden) |
| Equivalent .htaccess directive | Options -Indexes |
| Critical Targets | public_html, upload directories, asset libraries |
Steps
- Open Index Manager: In the Advanced section of cPanel, click Indexes.
- Navigate Directory Tree: Click folder icons to drill down to
public_htmlor target subfolders. - Edit Folder Display: Click Edit in the Actions column alongside the desired directory.
- Enforce No Indexing: Select No Indexing and click Save.
Troubleshooting and tips
- Expected 403 Forbidden Behavior: Navigating directly to a folder URL that lacks an
index.htmlorindex.phpwill correctly return an HTTP 403 response, confirming directory listing is actively blocked.
Need more help? If you run into an error while following these steps, open a ticket with technical support and our team will look into it. Open a ticket