Total Pageviews

Monday, 4 July 2016

h5ai is a modern file indexer for web servers

h5ai is a modern file indexer for web servers with focus on your files. Directories are displayed in a appealing way and browsing them is enhanced by different views, a breadcrumb and a tree overview. Initially h5ai was an acronym for HTML5 Apache Index but now it supports other web servers too.
See the demo directory with most features enabled.
Requires PHP 5.5+ and works fine with Apache httpdlighttpdnginx and Cherokee. Best user experience with modern browsers like ChromeFirefoxSafariOpera and IE10+, but a static fallback is provided for older browsers or if JavaScript is disabled.
There was a security flaw in versions 0.22.0 - 0.24.1 that was fixed in 0.25.0. If you are still using one of this versions you are advised to upgrade.


There are lots of optional extensions and configuration options to customize the web appearance of your directory listings. All markup is valid HTML5 spiced up with CSS3 and finest JavaScript to build a fresh but minimal user interface and a user experience that focuses on your files.
Some of the optional features:
  • sorting by name, date or size
  • different view modes and icon sizes
  • localization with lots of languages already included
  • breadcrumb and tree view for faster browsing
  • custom header and/or footer for each directory
  • filter for displayed files and folders
  • calculate folder sizes
  • auto refresh of folder content
  • packaged download of selected content (tar or zip)
  • QR codes for file links
  • thumbnails for images, movies and PDFs
  • image and text file preview (including Markdown rendering)
  • audio and video preview (depends on browser and codec)


  1. Copy folder _h5ai to the document root directory of the web server: DOC_ROOT/_h5ai.
     ├─ _h5ai
     ├─ your files
     └─ and folders
    Visit http://YOUR-DOMAIN.TLD/_h5ai/public/index.php, this page shows some hints on the server's capabilities.
  2. Add /_h5ai/public/index.php (note the leading slash!) to the end of the default index-file list. In this way h5ai will manage all directories in and below DOC_ROOT that don't have a valid index file.
Examples of the second step for all tested web servers:
  • Apache httpd 2.2/2.4: in httpd.conf or in any directory's .htaccess file set for example:
    DirectoryIndex  index.html  index.php  /_h5ai/public/index.php
  • lighttpd 1.4: in lighttpd.conf set for example:
    index-file.names += ('index.html', 'index.php', '/_h5ai/public/index.php')
  • nginx 1.2: in nginx.conf set for example:
    index  index.html  index.php  /_h5ai/public/index.php;
  • Cherokee 1.2: in cherokee.conf set for example:
    vserver!1!directory_index = index.html,index.php,/_h5ai/public/index.php


The main configuration file is _h5ai/private/conf/options.json. You might want to change some of the documented settings. But there are some more files in _h5ai/private/conf you might have a look at.


  • No web server specific things are supported, that includes access restrictions! Best chance to make restricted areas work and secure might be to place folder _h5ai completely inside that resticted area. Use it at your own risk!
  • Does not work with aliased folders in general (as available in Apache httpd). Aliased folders make it impossible to map URLs to file system folders.
  • If no icons are displayed, chances are that you have to add the SVG MIME-type to your server.
  • On Ubuntu servers you might need to install an additional package for PHP JSON support.
  • To use optional features based on shell commands the PHP functions exec and passthru must not be disabled in php.ini (have a look for disable_functions).

Custom installation

It's possible to install h5ai into any sub directory of your web server's document root. This directory will then be considered the root directory when showing a breadcrumb etc.
For example copy folder _h5ai to DOC_ROOT/some/folder/_h5ai:
 └─ some
     └─ folder
         ├─ _h5ai
         ├─ your files
         └─ and folders
Visit http://YOUR-DOMAIN.TLD/some/folder/_h5ai/public/index.php to see if everything works fine. In this example you need to add /some/folder/_h5ai/public/index.php to your the directory index (as in step 2 above).


HTTP web server index for Apache httpd, lighttpd, nginx and Cherokee。


  • Do not install any files from the src folder, they need to be preprocessed to work correctly!
  • Find a preprocessed package and detailed install instructions on the project page.
  • For bug reports and feature requests please use issues.


There are installation ready packages for the latest releases and dev builds. But to build h5ai yourself either git clone or download the repository. From within the root folder run the following commands to find a fresh zipball in folder build(tested on linux only, requires node 6.0+ to be installed).
> npm install
> npm run build