Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make Apache2 serve directory index in json

When enabled and privileged, the mod_dir module in Apache2 automatically serves a HTML formatted page with the contents of a directory when a directory is requested which does not contain an index.html file. I am looking for an easy way to make these directory contents machine readable; Preferebly have the contents of the directory formatted as a JSON array containing the subdirs/subfiles instead of an HTML page.

What would be a an easy way to accomplish this, that works on most standard configurations of Apache2.2? (no php scripts please)

like image 652
Jeroen Ooms Avatar asked Apr 19 '12 17:04

Jeroen Ooms


1 Answers

What would be a an easy way to accomplish this, what would work on most standard configurations of Apache2.2?

There isn't one. You'd need to either modify and rebuild mod_autoindex, or you'd need to redirect to a script or generated JSON file on the server.

like image 61
Ignacio Vazquez-Abrams Avatar answered Sep 30 '22 16:09

Ignacio Vazquez-Abrams