Combining ScriptAlias and DirectoryIndex

Apparently that's not possible. When you say "ScriptAlias /cgi-bin /usr/lib/cgi-bin", everything under /usr/lib/cgi-bin is assumed to be a script. That counts for directories, too; so trying to access 'http://localhost/cgi-bin/myapp' isn't going to work, even if you say 'DirectoryIndex index.cgi' and create a file /usr/lib/cgi-bin/myapp/index.cgi.

Workaround: use mod_rewrite:

<Directory /usr/lib/cgi-bin/myapp>
	RewriteEngine on
	RewriteBase /cgi-bin/myapp
	RewriteRule ^$ index.cgi
</Directory>

Sucky, but it works.