cPanel uses directory listing to show files and folders within a directory when there’s no main page (like index.html or index.php). When a visitor accesses a directory on a website without an index file, the web server may show a list of files and folders in that directory. This is called directory listing or directory indexing.
While directory listing can be useful for website administrators to see a directory’s contents from a web browser, it’s also a security concern. Disabling directory listing for public access is highly recommended. This prevents users from seeing your website’s file structure and potentially accessing sensitive files.
To manage directory listing in cPanel, use the “Indexes” option:
Steps to Disable Directory Listing in cPanel
1. Log in to your cPanel account using your username and password.
2. Once logged in, go to the “Advanced” section or use the search bar to find “Index Manager.”
3. Click on the “Index Manager” option to control directories that are shown on your website,
4. Next, choose the specific directory where you want to disable directory listing. For a global effect, you can select the “public_html” directory.
5. Once you’re in the “Index Manager” interface, you’ll find various options for directory indexing. To disable directory listing, simply choose the “No Indexing” option. Selecting this option will prevent the public from viewing the contents of this directory on your website.
6. Don’t forget to click “Save” or “Save Changes” to apply your adjustments.
7. Once you’ve disabled directory listing, if someone tries to access a directory on your website without an index file (like index.html or index.php), they won’t see a list of the directory’s contents anymore.
8. Instead, they’ll likely encounter a “403 Forbidden” error or a similar message, depending on the server’s configuration. This helps to enhance the security and privacy of your website’s file structure.