Disable Directory Listing in cPanel – 3 proven methods

62 views 6 minutes read
A+A-
Reset

If you are using Shared Hosting to host your website, this article is one of the important guide to boost security and performance of your website. Most commonly, cPanel is used in Linux based servers and used primarily for hosting php based websites.

However, it has vast support for other programming languages, still PHP & MySQL being the most common and open source technologies, the budget web hosting companies use cPanel. Its easy to use and lightweight as well with all the needed options of customization.

Why to Disable Directory Listing in cPanel?

On the published website, we have some folders which are used to store static objects or codes which are not meant for public or the search engine bots. By default, most web hosting companies keep Directory Listing enabled which leads to those files visible to everyone and even user with right tool can download your entire data in one click.

How to Disable Directory Listing in cPanel?

This article will focus on how to disable Directory Listing in cPanel. We have three methods to enable and disable Directory Listing. Let’s explore them each at a time.

Method 1: Using Index Manager

Detailed Steps:

  • Log in to your cPanel account.
  • Find the Index Manager option. It may be located in the Advanced section or under Files.
Disable Directory Listing in cPanel - 3 proven methods 2
Location of Index Manager
  • Click on the Index Manager. It will display a directory tree of your website.
  • Navigate to the directory where you want to disable directory listing. You can do this by clicking on the folder icons.
Index Manager in cPanel to enable/Disable
cPanel Index Manager options for disabling Directory.
  • Click on the directory name. This will display the indexing options for that directory.
  • Select the “No Indexing” option.
  • Click the Save button.

Method 2: Using .htaccess file

  • Open File Manager and navigate to the directory you want to enable/disable Directory listing.
  • Look for .htaccess file in the folder. If dot files are hidden, this article will help you how to enable them.
  • If the file is not already present, you can always create and name your file as .htaccess (dot (fullstop) symbol at beginning and then htaccess)
  • Add following code at the beginning of page.
    • If you want to enable directory listing: Options +Indexes
    • If you want to disable directory listing: Options -Indexes

Result before and after using htaccess file to enable and disable directory listing.

Method 3: Using Index.html file.

Just like we did on method 2, you have to add maybe a blank or if you can create something nice with Access Denied message index.html file in each directory.

However, this is inefficient way and we have to copy paste file in each and every directory which we want to disable listing.

But, .htaccess or the index manager are the best and most efficient methods to enable or disable directory listing on cPanel.

With belief that this information will help you in the time of need, we thank you for reading our posts.

If you like the content you read here, please consider subscribing to our mailing list to get notification of such useful content. You can also subscribe to us on YouTube to get audio-visual content on various technical topics.

Related Posts

Leave a Reply

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Index

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.