Default index files and directory listings

index.html, index.php, directoryindex, directory listing, indexes · 0 found this helpful

When a visitor opens a folder address, such as https://example.ca/, the server looks for a default file inside. This article explains the order and what happens when none exists.

Default order

On our servers the order starts like this:

  1. index.php
  2. index.html
  3. index.htm

The first one found loads. If none exists, the visitor sees either a file list or a 403 error.

Change the order

Add a line to .htaccess:

# Load home.html first, then the usual files
DirectoryIndex home.html index.php index.html

Folder listings are a separate setting, covered below.

Hide or show file lists

If a folder has no index file, the server can list its contents. That exposes file names you may not want public.

# Hide file lists (recommended)
Options -Indexes

# Show file lists (only if you want a download folder)
Options +Indexes

In your account, open Account → Hosting → your site → Files and click Manage under Folder and server rules. Type the folder under Folder settings, click Show, and find File listing. Choose whether visitors see a list or are blocked.

Quick fix for exposed folders

Put an empty file named index.html in the folder. Visitors then see a blank page.

If something goes wrong

  • Old home page keeps appearing: another index file ranks higher, such as a leftover index.html above your new index.php.
  • "Forbidden": no index file and listings are off. Add the file.

Was this helpful?

Still stuck? Ask us and we'll walk you through it.