Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  cPanel  >  How to Enable/Disable Directory Listing with .htaccess via cPanel?
Top Scroll

How to Enable/Disable Directory Listing with .htaccess via cPanel?

 2 min

Watch this video for a step by step process on How to Enable/Disable Directory Listing with .htaccess via cPanel

Directory listing is a crucial part of web hosting. As a cPanel user, you can enable or disable directory listing with .htaccess.

For security reasons, it is common for web servers to disable directory listing. You will get a 403 HTTP Forbidden Access error if you don’t have an index file in a directory. It does not allow the client to see the files in the directory. If you want to show these files, you have to enable the directory listing.

To Enable Directory Listing with .htaccess

1. Create a .htaccess file in the cPanel File Manager.

Just name the file as .htaccess.

If you already have the .htaccess file, find and edit the file in the cPanel File Manager.

For users who don’t know how to create/edit .htaccess file, refer to the article: How To Edit A .htaccess File Through The cPanel File Manager?

2. Enter/copy this code at the beginning of the file:

Options +Indexes

3. Click Save Changes and Close.

The next time you browse for the directory listing, it will display the index.

To Disable Directory Listing with .htaccess

1. Create/edit the .htaccess file in cPanel File Manager.

2. Enter/copy this code at the beginning of the file:

Options -Indexes

3. Click Save Changes and Close.

The next time you browse for the directory listing, it will display the 403 HTTP Forbidden Access error.

That is how you can configure the .htaccess file via cPanel to enable/disable directory listing.

For our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
30
MINS
59
SECS
Claim the discount before it’s too late. Use the coupon code:
STORYSAVER
Note: Copy the coupon code and apply it on checkout.