How to Turn Directory Listings On or Off in cPanel (Indexes)

If a folder on your website has no index.html or index.php file, visitors may see an "Index of /folder" page listing every file inside it. That's handy for a download folder, but usually it's something you want to hide. This guide shows how Instant Access Internet Services customers can turn directory listings on or off in cPanel with the Indexes tool, and how to do the same with .htaccess.

Why disable directory listing?

  • It stops people browsing files you didn't mean to publish -- old backups, PDFs, spreadsheets, private images.
  • It hides your folder structure and plugin names from attackers looking for weak spots.
  • Search engines can't find and index stray files through the listing.

WordPress and most other website software already include index files in their main folders, but upload and custom folders often don't.

How to turn directory listings on or off with Indexes

  1. Log in to cPanel and go to Advanced > Indexes.
  2. If a window asks which directory to open, choose Web Root (your public_html folder) and continue. (You can change this later with the Settings button.)
  3. Find the folder you want to change. Click a folder icon to open it, or click Up One Level to go back. To change your whole website, stay at public_html.
  4. Click Edit next to the folder.
  5. Choose one of the options:
    • Inherit -- use the same setting as the parent folder (the default).
    • No Indexing -- turn directory listing off. Visitors get a "403 Forbidden" message instead of a list of files.
    • Show Filename Only -- turn directory listing on, showing a simple list of file names.
    • Show Filename and Description -- turn directory listing on, with file sizes, types and dates.
  6. Click Save.
  7. Check the result: visit the folder in your browser, for example https://example.com/files/, in a private window.

The setting applies to the folder and every folder inside it, unless a subfolder has its own setting. So choosing No Indexing on public_html turns listings off for your whole site, and you can still turn them back on for one download folder.

Alternative: use .htaccess

The Indexes tool simply writes a line to the .htaccess file in that folder. You can add it yourself in File Manager if you prefer:

  1. In cPanel, go to Files > File Manager and open the folder (for example public_html).
  2. Make sure hidden files are shown (Settings > Show Hidden Files (dotfiles)), then edit .htaccess, or create it if it doesn't exist.
  3. To turn listings off, add this line on its own:
    Options -Indexes
    To turn them on for a folder, use:
    Options +Indexes
  4. Save the file.

Don't paste this into WordPress's .htaccess between the # BEGIN WordPress and # END WordPress lines -- WordPress can overwrite that block. Put it above it.

Troubleshooting

I turned listings on but still get 403 Forbidden

  • Check the folder's permissions are 755 and the files are 644.
  • A parent folder's .htaccess may have Options -Indexes or another rule blocking access.
  • If the folder is password-protected with Directory Privacy, you'll be asked to log in first.

I turned listings off but the files still show

Clear your browser cache, or try a private window. If you use LiteSpeed Cache, purge it. Also check that a subfolder doesn't have its own Options +Indexes line.

My home page now shows "403 Forbidden"

Your site is missing its index file. Make sure public_html contains index.html or index.php. Turning off directory listings only hides folders that have no index file -- it never blocks a real page.

Can I show a nicer page instead of 403 Forbidden?

Yes -- create a custom 403 page. See the custom error pages guide.

Related guides

Still stuck? Open a support ticket and the Instant Access Internet Services team will help.

Ultrafast LiteSpeed hosting from InstantAccess.net: free SSL, free backups, cPanel included, no contracts. Check out our $10/month hosting.
  • disable directory listing, cpanel indexes, directory browsing, index of folder, options -indexes htaccess, hide folder contents website
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Show Hidden Files (.htaccess) in cPanel File Manager

If you are looking for your .htaccess file and it isn't there, it's almost certainly just hidden....

How to Use cPanel File Manager to Manage Your Website Files

cPanel File Manager lets you work with your website files right in your web browser -- no FTP...

How to Edit a File in cPanel File Manager

Instant Access Internet Services customers can edit a file in cPanel File Manager right in the...

How to Upload and Extract a ZIP File in cPanel

The fastest way to put a whole website or a folder full of files on yInstant Access Internet...

How to Compress and Download a Folder in cPanel

cPanel File Manager can download single files, but not whole folders. The trick is to compress...