Black Friday Hosting Deals: 69% Off + Free Migration: Grab the Deal Grab It Now!
In managing your website on the cloud server, maintaining security and control of directories is the most important thing. Achieving this purpose can be done through the .htaccess file, as it serves as a very powerful configuration file and aids in controlling various aspects of your web server.
In this knowledge base guide, we'll explain how to enable/disable folder listing through a .htaccess file using cPanel, a widely used web hosting control panel.
Directory listing, otherwise known as directory browsing, can be defined as the action of visiting the contents of the directory of a given website when there is no index file (like index.html) available. This shows that the case security can be a threat because the files and directories become vulnerable to unauthorized access. Nevertheless, with .htaccess, you could easily create a file for directory listing which can be prohibited.
Now, you'll need to access your cPanel account and navigate to the File Manager tool. Follow these steps:
Log in to your cPanel account using your credentials.
Locate and click on the "File Manager" icon within the Files section.
Then, go to the File Manager, and you will be able to edit the .htaccess file. undefined
File Manager will take you to the directory into which you want to enable or disable directory listing.
Tap the "+ File"button that is situated in the upper right-hand corner.
Enter `htaccess` in the "File name" text box and click on "Create New File" button.
At this point, you already have the .htaccess file prepared. Hence, you can consequently turn on or turn off directory listing according to your necessities.
To enable directory listing, add the following line to your .htaccess file:
Options +Indexes
This directive tells the server to allow directory listing for the directory where the .htaccess file is located. After adding this line, save the changes to the .htaccess file.
If you want to disable directory listing to enhance security, add the following line to your .htaccess file:
Options -Indexes
This directive instructs the server to disable directory listing for the directory. Remember to save the changes after adding this line to the .htaccess file.
When you are through with the edits to the .htaccess file, it is crucial to check if the directory listing has been enabled or disabled to your liking. You can accomplish this by using such a means as simply opening the file in your web browser. Enabled the directory listing if one appears; you should see the list of files and directories. The situation is if it is disabled, you will likely receive feedback announcing that directory listings are forbidden, while it is the case when it is enabled.
To sum it up, by employing .htaccess directory listings control via cPanel on an SCSP (Server Cloud Service Provider) you increase your site’s protection level. These instructions will properly guide you on allowing or disabling the listing of the public directory based on your preferences. Do make sure to remind yourself to keep your .htaccess file up-to-date at regular intervals to get the security of your website at the best level.
Let’s talk about the future, and make it happen!
By continuing to use and navigate this website, you are agreeing to the use of cookies.
Find out more