cPanel's installation by default installs and enable
mod_autoindex. This causes
Apache to display the list of files and folders of a directory whenever
DirectoryIndex files such as
index.php are not present.
You can typically edit
Apache HTTP server configuration file to disable directory listing, but it's not accessible from a
You can disable directory browsing in
cPanel from the
Advancedsection and click on
Click on the folder icon to browse the directory and click on the folder name to select the particular directory.
public_html is the root of the web folder and selcting it will apply the setting to all the subsequent subfolders. Some hosting also has
www which is just a softlink to
public_html so effectively they're both the same directory
No indexingfrom the option and click on the
What happens in the background is
cPanel will append the following line to the folder's
.htaccess file to disable directory listing.
.htaccess file will be created if it doesn't already exist.
Comment anonymously. Login not required.