The 2 - 5 conditions and rules makes a php script search engine friendly.
And the last condition and rule allows usernames in URLS to be passed to a php script.
All of this works fine, except if I try to go to a real directory, it will not automatically pull up the index.php page. If I take away the url rewriting, it works again. For example, if I try to go to http://www.domain.com/mydir/, I get a page not found. However, if I go to http://www.domain.com/mydir/index.php, it works.
For rewrite rule problem. just enable rewrite log, for vhost from httpd.conf, use directive
"RewriteLogLevel 9" for that vhost, then check rewrite related log entries in the error log.