Directory index files

Categories Web HostingFile Management Tags htaccesshtml

When a request is made to a URL that points to a directory instead of an actual file within a directory, web servers will typically serve a default index page such as an index.html or index.php file. If this file does not exist on the server or the server is not configured to display this file, a list of all the files and directories located inside the current directory may be displayed.

Users can modify what index file is loaded by default when a directory is navigated to.

Directory index files on Cloud Hosting

Follow the instructions below to modify the default index page on Cloud Hosting accounts:

  1. Log into your Account
  2. Manage the domain you want to make changes to
  3. Click Cloud Hosting
  4. Click Click to modify your index pages
  5. Add a new default index page or remove an existing one
If multiple default index pages exist, preference will be made to the index.htm and index.html files on the server.

Directory index files on cPanel Hosting

Follow the instructions below to modify the default index page on cPanel Hosting accounts.

Please note that modifying the directory index file on a cPanel Hosting account requires users to modify their .htaccess file. If modified incorrectly, you could break your live website. It is recommended you backup your .htaccess file before attempting to make any changes to it.

  1. Log into your Account
  2. Manage the domain you want to make changes to
  3. Click cPanel
  4. Click the File Manager icon
  5. Select Home Directory
  6. Tick the box next to Show Hidden Files (dotfiles)
  7. Click [Go]
  8. Navigate to the public_html directory
  9. If a .htaccess file exists, select it then click the Edit icon
  10. If no .htaccess file exists, click on the New File icon and create a file called .htaccess
  11. Type in the below code into your .htaccess file
    DirectoryIndex filename.ext
    eg. DirectoryIndex index.php
  12. If you want to add additional default index file options, you can add a space and include additional file names
    eg. DirectoryIndex index.php index.htm index.html Index.html
  13. Once done making the appropriate changes, click [Save Changes]
.htaccess files work recursively, meaning all the subfolders that do not have their own .htaccess file will listen to the directive given by the .htaccess file placed in the root directory.

Rate this article
Get more leads