Skip to content

Changing the default directory index via .htaccess

By default, Apache servers look for index.html when a visitor requests a directory (e.g., http://example.com/products). On ruachost.com, you can customize which file loads first by editing the .htaccess file.

  • Display a different file (e.g., index.php instead of index.html).
  • Use multiple fallback options (e.g., home.html, default.php).
  • Control how directories behave when no index file exists.
  • Improve flexibility for CMSs or custom applications.
  1. Log in via FTP, SFTP, or File Manager.
  2. Navigate to your site’s root directory (public_html).
  3. Open or create the .htaccess file.

Insert the following line:

DirectoryIndex index.php index.html index.htm home.html
  • Apache will look for files in the order listed.
  • In this example, it will first try index.php, then index.html, then index.htm, and finally home.html.
  1. Save the .htaccess file.
  2. Visit your site in a browser.
  3. Confirm the correct file loads when accessing a directory.