Hostwinds Tutorials

Search results for:


Table of Contents


How To Prevent Listing of Files in Your Directory
Other Alternatives

cPanel Indexes

Tags: cPanel 

How To Prevent Listing of Files in Your Directory
Other Alternatives

This article is about using cPanel to manage the indexing of your folders. To prevent the listing of the contents of your folder, this is a way to ensure your website visitors are not able to view the contents of a folder that does not contain an index file such as index.php, index.html, index.htm, or another filename that can serve as your homepage. This article is intended for a Shared Hosting, Business Hosting, Reseller Hosting, or other clients who have purchased a cPanel license through Hostwinds are using cPanel on any of our Shared Web Hosting services. Hostwinds clients may notice that when viewing a directory, all of the files in that directory or folder are shown to a website visitor.

How To Prevent Listing of Files in Your Directory

Login in to your cPanel account

Navigate to the Advanced section

Find the Indexes Icon

and click on it

Click on the actual folder name, such as

and not the folder icon (

)

Check the Radio Button next to No Indexing to prevent your files from being shown when visiting your website.

Click the Save Button to save your changes.

Repeat this process for any other folders you have created that do not contain an index file to prevent the files from being listed when visiting your directories for any document roots such as public_html since these are publicly accessible to view from any web browser

If you would like to show the files in your directory, simple select Default System Setting, Standard Indexing (filename only), Fancy Indexing (filename and description)

Other Alternatives

If a file named .htaccess exists in your public_html directory, first create a backup of this file so you can easily restore it.

Create or edit the existing .htaccess file in your public_html directory or folder that you would like to restrict a list of files from showing

Add the following line to your .htaccess file:

Options -Indexes

Save the file and view your changes by visiting the folder in your web browser.

If we can help you in any way, please submit a ticket, or join us in a Live Chat anytime. We are available 24/7/365, and we are dedicated to our client's success; every client truly matters to us.

Written by Hostwinds Team  /  April 5, 2018