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.
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.