In this article, we have explained how to restrict directory listing in cPanel.
Follow the steps-
- Log in to cPanel.
- Select the “Advanced” category and click on the “Indexes” sub-option.
- Once on the new page, find the “public_html” folder.
- Click on the “Edit” button.
- Set indexing as “No Indexing” and click on the “Save” button.
- Disabling the directory indexing will be accomplished and you will receive a notification as shown below.
- You also have the option to upload an empty “index.html” or “index.php” file if you prefer not to display any content on your website while still preventing directory listing.
- Alternatively, you can enhance your website’s configuration by including specific code lines in your “.htaccess” file.
- The following lines will define which file serves as the initial page of your website. Just remember to substitute the newpage.html with your index file name.
#Alternate default index page
DirectoryIndex newpage.html
That’s it! This was the easiest way to restrict directory listing in cPanel. For more information, contact our technical experts. Also, do not forget to check our latest web hosting plans.