To disable directory listing in cPanel, you can use the .htaccess file. Here are the steps to follow:

  1. Log in to your cPanel account.
  2. In the Files section, click on the "File Manager" icon.
  3. Locate the .htaccess file in the public_html directory. If you do not see the file, make sure that "Show Hidden Files" is enabled in the settings.
  4. Right-click on the .htaccess file and select "Code Edit" or "Edit".
  5. Add the following line to the file: Options -Indexes
  6. Save the changes and close the editor.

This will disable directory listing for the entire website. If you want to disable directory listing for a specific directory, you can create a new .htaccess file in that directory and add the same line.

Alternatively, you can also disable directory listing by adding the following line to the Apache config file,

<Directory /path/to/directory> Options -Indexes </Directory>

Please note that disabling directory listing can help to improve the security of your website by preventing people from easily browsing the contents of your directories. However, it may also prevent some legitimate uses of your website, so it's important to test your website after making this change.

Ha estat útil la resposta? 4 Els usuaris han Trobat Això Útil (41 Vots)