The thing called RewriteRule just changes the left
side URL into the
right side URL. I don't know exactly how to do what you want to do,
but your question is not a MediaWiki question, so if you are really
stuck I'd suggest finding a tutorial about RewriteRule on the internet
and reading it. You might need to find out about regular expressions
as well.
many thanks.