If I’m not misunderstanding you, it would determine it exactly the same way, as for example WordPress redirects:
Check out .htaccess file an example WordPress installation can generate for you. It is quite complex and maybe among it, you will find what you are looking for.
I’m on the other hand a complete newbie to Apache’s Rewrite Engine therefore I may be thinking about something else then you are thinking. But I heard that with mod_rewrite you can do absolutely magic, it is that extensible and flexible. There was even a whole book published only on this subject - understanding Apache’s mod_rewrite.