How to Disable Directory Listing in Cpanel

By default, most Web Servers allow visitors to your website to see the contents of a directory if you have not defined a default index file. This can be index.htm or index.html or index.php.

Allowing directory listing exposes your website information to malicious visitors hence giving them a clue of your website structure. This is one of the worst security risks that you can ever take. In this guide, I am going to show you a step by step procedure on how to disable directory listing in your Cpanel as a security measure for your website.

Prerequisite.

1. A domain name e.g truehost.co.ke

2. A Hosting package with a Cpanel.

3. The Cpanel credentials I.e Username and Password.

Disabling Directory Listing

There are several ways that you can go about turning off directory indexing from the Cpanel.

Method 1

Step 1: Log in to your Cpanel.

Step 2: Scroll to the “Advanced” section and click on “Indexes”

Step 3: On the folder for which you want to disable directory listing, click on “edit”

Step 4: On the next page select “No Indexing” and click “Save”

That is all for method 1.

Method 2

Step 1: Log in to your Cpanel.Step 2: Click on “File Manager” under the “Files” Section.

Step 3: Select and right-click on the folder that you wish to disable directory listing.

Step 4: Click on “Change Permissions”

Step 5:  Assign the permission to be “771” by simply ticking the necessary boxes as shown below in blue. This prevents the folder to be accessible by visitors to a website.

Step 6: Click on “Change Permission” to save the changes.

Method 3

Step 1: Log in to your Cpanel.

Step 2: Click on “File Manager” under the “Files” Section.

Step 3: Select and right-click on the folder that you wish to disable directory listing.

Step 4: Click on “Manage Indices”

Step 5:  Click on “No Indexing”

Step 6: Click on “Save”

That is all you ought to know in regards to disabling directory listing in your Cpanel.  Once you do that, anyone who tries to visit a directory with no default page will automatically get a forbidden error message. This is an awesome security measure to protect your important information from being accessible to be public.

Was this article helpful?

Related Articles

Leave A Comment?