Computer Tips - Apache: Make the autoindex pretty

Date: 2019dec4 Product: Apache OS: Linux Keywords: format Q. Apache: Make the autoindex pretty A. First ask it to include your style sheet. In file /etc/httpd/conf.d/autoindex.conf add:
IndexStyleSheet /autoindex/autoindex.css
I also like it to avoid truncating the file names:
IndexOptions NameWidth=*
To this line
AddIcon /icons/binary.gif .bin .exe
I added:
AddIcon /icons/binary.gif .bin .exe .apk
so Android apk's get a better icon Now in your document root folder (by default it is /var/www/html)
mkdir autoindex (Doesn't have to be that name) cd autoindex
Then make autoindex.css
* { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; } /* Copied from Bootstrap 4 */ a:link { text-decoration: none; } a:hover, a:active { text-decoration: underline; } table { border-collapse: collapse; } table { margin: 1em; } .odd { background-color: #eee; } .even { background-color: #fff; } .indexbreakrow { display: none; } .indexcolsize { padding-left: 1em; } .indexcoldesc { padding-left: 1em; }
Of course, you can change this as you wish. Its great that Apache adds a class to everything so we can customize it. And restart Apache
systemctl restart httpd