Hi Middleman,
Happy to see your enthusiasm..
Please nte that I am a newby with rewrites! I only started a few months ago, and I am waiting for my first fully modrewrite site to go live (Domain transfer should happen any day now!).
The rewrite happens on the URL, not on the query string. So you can match the URL. But I think you are looking for the opposite of what you mention.
You want to rewrite the new urkl:
domain.com/user/name
to
domain.com/user/index.php?user=username
right?
an example:
What I did, is go to a new situation, where I used to pass languages through a query string, and now I do them in the url.
so first I grab catch the links that still use the old system, and externally redirect the page to a new encoded system (So that the address bar shows the correct way to get to the page):
#-- rewrite ?lan=en to /en/
RewriteCond %{QUERY_STRING} lan=([a-zA-Z]+)
RewriteRule ^(.*)?$ http://%{SERVER_NAME}/%1/$1? [R,L]
Further down I internally rewrite that back to the old-style path:
# Do the rewrite; we go from requested domain/(en|nl)/URI to served: domain/index.php?l=(en|nl)&p=URI
RewriteRule ^(en/|nl/)?(.*)?$ index.php?l=$1&p=$2 [L]
This in effect is also just for nicety, although in my case it is also required to keep the folders and stuff working ok.
You CAN grab the username, but you need to know that you are looking for a user, e.g., by having the folder user/ after the domain name:
domain.com/user/USERNAME