How to Disable Directory Listing in cPanel

How to Disable Directory Listing in cPanel

Apache’s web server default behaviour allows users visiting your website to see the contents of a directory if you haven’t defined a default index file (e.g. index.html or index.php).

Leaking such kind of information to the world is very dangerous because malicious users are given a better clue of your website structure or the building blocks of your web application.

In this, guide, we will show you how to disable directory browsing on cPanel and make your website more secure.

Prerequisites

Step 1: Login to your cPanel account

First, visit your cPanel account by typing the domain name followed by ‘/cpanel’. Enter your username and password and click on ‘Login’

Step 2: Locate Index manager from the dashboard

In cPanel dashboard, type the word ‘indexes’  on the search box as shown below and click the icon that appears below:

Step 3: Use Index Manager to disable directory listing

On the next screen, cPanel Index Manager will display all the top level directories from your hosting account. You need to select the directory that you want to customize. So, because you are protecting directories under the root of your website, select the ‘public_html’ folder

Next there is an option for customizing how your web directories will be viewed on the web.

The index manager allows you to choose from different options including:

  • Default System settings,
  • No Indexing,
  • Standard Indexing
  • Fancy Indexing

To completely switch off directory listing on your account, choose ‘No Indexing’ as shown on the image below:

Step 4: Testing the setup

Create a new ‘test’ directory under the ‘public html’ folder using cPanel file manager

Then, visit your new ‘test’ directory on a web browser using the URL ‘www.example.com/test’. Remember to replace ‘example.com’ with your domain name. If directory listing was disabled successfully, you should see the error message below.

Conclusion

That’s all when it comes to disabling directory browsing in your cPanel account. From this point forward, anyone trying to visit a directory with no default page will get a forbidden error message. This will add a new layer of security to your website because users will no longer be able to view the structure of your website or web application.

 

Check out these top 3 cPanel hosting services:

Hostinger
$2.99 /mo
Starting price
Visit Hostinger
Rating based on expert review
  • User Friendly
    4.7
  • Support
    4.7
  • Features
    4.8
  • Reliability
    4.8
  • Pricing
    4.7
HostArmada
$2.49 /mo
Starting price
Visit HostArmada
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.5
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.0
FastComet
$1.79 /mo
Starting price
Visit FastComet
Rating based on expert review
  • User Friendly
    4.7
  • Support
    5.0
  • Features
    4.8
  • Reliability
    4.5
  • Pricing
    5.0

How to Install a SSL/TLS certificate on Your Shared Hosting Account

This guide will show you how to install an SSL/TLS certificate in cPanel for a s
3 min read
Avi Ilinsky
Avi Ilinsky
Hosting Expert

How to Encrypt Email Using cPanel

This article will help you configure email encryption on your cPanel web hosting
2 min read
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester

How to Use and Manage SSH Keys with cPanel

This guide shows you on how you can use cPanel to create and manage secure shell
3 min read
Max Ostryzhko
Max Ostryzhko
Senior Web Developer, HostAdvice CTO

How to Enable Hotlink Protection in cPanel

Learn how to enable hotlink protection on your website and prevent other website
3 min read
Arvind Singh
Arvind Singh
Hosting Expert
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top