What about this in a .htaccess file :
RewriteEngine on
RewriteRule ^$ /index.php [L]
RewriteRule ^([a-zA-Z0-9\-\_/]*)/$ /$1/index.php [L]
RewriteRule ^([a-zA-Z0-9\-\_/]*)\.(html|htm)$ /$1.php [L]
RewriteRule ^([a-zA-Z0-9\-\_/]*)$ /$1.php [L]
Typing "sub.domain.foo/anything" loads "/anything/index.php" if 'anything' is a directory, else it loads "/anything.php".
I'm sure you can find mutch better, but it works great on my site :)