How to disable directory listing / browsing – cPanel

By default servers allow directory browsing via http frontend to the visiting users. However you might want to disable directory listing in some situations where you don’t want to allow your users to see the files and folders present in the web servers directories.

Servers show the directories and files if default files aren’t present in those directories (index.html, default.html etc).

This can be solved easily. Directory browsing can easily be disabled by using htaccess too but in cPanel (and other server management softwares) there is easier way of doing it via GUI.

How to disable directory listing / browsing in cPanel

1. Login to your cPanel account by going to http://domain.com/cpanel

2. On the main cpanel page, look for: “Index Manager” (found under “Advanced” section in cPanel11)

index manager cpanel11

3. The popup will ask you which website domain (or subdomain you want to disable directory listing for) select the one you want to.

4. Once in the Index Manager panel it will ask you to select the folder under which you want to disable directory listing. Here you can either chose to disable directory listing for all the site directories or for any particular folder so that only the sub folders inside that directory get directory browsing disabled by cPanel.

5. Save the settings and check by going to one of your folders without index.html or other default files to confirm. It should give you a Forbidden error saying:

Forbidden

You don’t have permission to access /amit/ on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

If you have any difficulty

Let me know if you have any difficulty in turning off the directory browsing or listing on on your server using cPanel index manager.

Leave a Reply

Your email address will not be published.