I am looking to rewrite urls with multiple substrings. One substring is being requested as a subdirectory, while any others are requested as normal query string parameters.
In addition to using the rewrite flag QSA, you can also use the QUERY_STRING environment variable as shown below:
RewriteEngine On
RewriteBase /
RewriteRule ^([A-Za-z0-9-_]+)/friends$ /friends.php?user=$1&%{QUERY_STRING}
And the URL in question
http://www.example.com/mark/friends?page=2
will be rewritten to (as specified):
http://www.example.com/friends.php?user=mark&page=2