Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Change the look of Apache directory listings

When a folder has no index page, Apache can show a list of its files. This guide shows how to change how that list looks.

Web Hosting2 min read11 steps

What is a directory listing?

If you open a folder address and the folder has no index.html or index.php, Apache may show a plain page that lists the files inside. That page is the directory listing. Apache is the web server program that sends your pages.

Use listings only for folders you want to share, such as downloads. For other folders, leave them off for safety.

Turn the listing on or off

Settings go in a file named .htaccess inside the folder. It is a small settings file that Apache reads for that folder. Back it up before editing.

Options +Indexes

This turns the listing on. Use Options -Indexes to turn it off.

Steps to change the style

  1. Log in to cPanel and open File Manager.
  2. Show hidden files from Settings.
  3. Go to the folder you want to share.
  4. Open or create .htaccess and click Edit.
  5. Add the lines you want from the list below.
  6. Save the file.
  7. Reload the folder address in your browser.

Useful settings

Options +Indexes
IndexOptions FancyIndexing HTMLTable NameWidth=* DescriptionWidth=*
IndexOptions FoldersFirst IgnoreCase
IndexIgnore .htaccess *.php
  • FancyIndexing adds icons and sortable columns.
  • HTMLTable puts the list in a table.
  • FoldersFirst shows folders before files.
  • IndexIgnore hides files from the list.
  1. Create a file named header.html with a short title or welcome text.
  2. Create a file named footer.html with any closing text.
  3. Create a file named style.css with your colors and fonts.
  4. Add these lines to .htaccess:
HeaderName header.html
ReadmeName footer.html
IndexStyleSheet "/style.css"

These lines load your header, footer and stylesheet into the listing page. The stylesheet path is measured from your website root.

Tip: If you get a 500 error, a line may not be allowed on your server. Remove the last line you added. Ask Hostvento support if it keeps happening.

Quick recap

  • A directory listing shows files when a folder has no index page.
  • Use .htaccess to turn it on and change its style.
  • IndexOptions, HeaderName and IndexStyleSheet change the look.
  • Keep listings off for private folders.