To disable directory listing in cPanel, you can use the .htaccess file. Here are the steps to follow:
- Log in to your cPanel account.
- In the Files section, click on the "File Manager" icon.
- 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.
- Right-click on the .htaccess file and select "Code Edit" or "Edit".
- Add the following line to the file: Options -Indexes
- 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.
Search
Popular Posts
How to Install aaPanel Web Hosting Control Panel on Your Server
16/12/2023
How to Block Outgoing Traffic to Private Networks Using UFW on Your Server
02/05/2024
How to Downgrade WordPress: Reverting to a Previous Version
22/08/2023
How to install applications (WordPress, Joomla, Drupal, Magento, and many more) automatically with cPanel?
26/01/2023