How to Disable Directory Browsing

blog background image

How do you keep people from stealing your reports, images, and other files you have stored on your hosting server? 

If you have web hosting many of your files are open to inspection by anyone who has an interest.

This includes files you are using for redirects, images, pdf’s, etc.

The reasons to disable your directory browsing is for privacy of course, but it will also help protect your site against hackers because it will hide your files making you less vulnerable to attack. You are more susceptible to hackers if they can see your themes, plugin’s etc. Often hackers are looking for a particular theme or plugin because they have already found a way to exploit it.

The directory is the default page the web server will go to if you don’t have an index file directing otherwise. Here is a sample of what a directory tree of your website will look like.

 

 

How to Disable Directory Browsing in cPanel

This works like a charm for your shared hosting with cPanel.

Step 1.
Log in to your cPanel

Step 2.
Click on Indexes 

Step 3.
The directory tree will display. Select what level or folder you want disabled.
If you want to disable the entire site then select “Up One Level” and select the domain.

 

Step 4.
Select No Index and SAVE.

Step 5.
That should do it. Now when someone tries to access your files they will see a “403 Forbidden” HTTP status code notice that will tell the user your files are not accessible.

.htaccess Method to Disable Directory Website Listings for Blogs

If you don’t mind altering files then you can simply add one line to your .htaccess file.**

Step 1.
Log into your hosting or connect via FTP.

Step 2.
Download the .htaccess file

Step 3.
Open in a plain text editor.

Step 4.
Just add this line at the bottom.

 

Step 5.
Upload new .htaccess file

In many hosting companies you can do the edit online with your hosting companies editor.

You should now know how to disable Apache's DirectoryIndex setting server wide on your server. This can help increase security by ensuring a directory that doesn't include an index file isn't exposing any other possibly sensitive files.

Related Blog Post

Create, collaborate, and turn your ideas into incredible products with the definitive platform for digital design.

How to create cPanel backup from command line

12 December 2022

How to create cPanel backup from command line

This article explains how you can create cPanel backup from the command line, using your own username and password.

Read More
How to install Webuzo Panel on linux Server

12 December 2022

How to install Webuzo Panel on linux Server

Webuzo is a popular alternative to cPanel, a widely used web hosting control panel developed by cPanel, Inc.

Read More
What are NFT Domains?

02 February 2022

What are NFT Domains?

NFT domains are new web extensions that are deployed using ERC 721 and Polygon Network, except .zil which uses Zilliqa.

Read More
How to Delete a MySQL® Database

01 January 2022

How to Delete a MySQL® Database

This document describes how to manually delete a MySQL® database from a cPanel & WHM server. This is useful if, for exa

Read More
How to get Transfer Authorization Code from GoDaddy

11 November 2021

How to get Transfer Authorization Code from GoDaddy

To transfer your domain with us then must need EPP Code.

Read More

Got a question!

Contact us at