Getting started · Let.com knowledge base

How To Disable Directory Listing in cPanel

Updated 2024-08-222 min read

Hosting documentation. Account access is coming soon. Always use the server details and nameservers assigned to your own account.

By default in cPanel, if you don't upload an index.html, index.php, or index.htm file, when you load your domain in a browser you will see an "Index of /" page showing the folder contents for your domain when you load it in a web browser.

 

blobid0.png

Usually this can be fixed by simply uploading your site's content or adding an index.html file with a Coming Soon page until you have completed designing your site. But if you would like turn off directory listing entirely, this can be easily accomplished within cPanel.

 

1. Login to cPanel and click the button called Indexes under ADVANCED.

blobid1.png

 

 2. Click the Edit button next to public_html or the folder for your domain, such as /domain.com/ 

blobid2.png

blobid3.png

3. Select No Indexing and then click Save.

blobid4.png

 

Now that you have disabled directory listing, the domain will show a 403 error when loading a domain that is a missing an index.html or index.php file. This is better for security, but it is recommended to add an empty index.php or index.html file to get rid of this error message.


If you would like to change the name of the file that loads automatically to something other than index.html or index.php, you can add a couple lines of code to an empty file called .htaccess. The name that you choose will be the first page of your website that loads when you load your domain name in a browser.

 

#Change default index page
DirectoryIndex MyNewIndexPage.html

With this code added to an empty .htaccess file or the current .htaccess for your website, you can change the default first page of your site to MyNewIndexPage.html or any title of a file you would like to load automatically in place of index.html or index.php.

Did this point you in the right direction?

Talk to the Let.com team

Frequently asked questions

What you need to know.

Talk to our team

Why does my domain display an Index of directory listing?

The guide explains that this can happen when the folder has no default index file, such as index.html or index.php.

How does the guide disable that listing?

Open Indexes under Advanced in cPanel, edit the intended website directory, select No Indexing and save the setting.

Why does a 403 appear after directory listing is disabled?

If the directory still has no index page, the server can refuse to list its contents and return 403. Disabling the listing does not create a homepage.

Let.com

Coming soon.

Account sign-up, log-in and checkout are not available yet. You can explore our products and compare plans while we get everything ready.

Compare plans