It's easy. You can read mod_rewrite manual. Or if you need a tutorial, you can try the keywords: mod_rewrite, tutorial in Google.
Here I have to notice you after you set up mod_rewrite, you have to set the AllowOverride option of you directory to All (In your Apache setting). If it is None, mod_rewrite won't work.
For example, I use CentOS. The default value of AllowOverride is None, so you have to edit /etc/httpd/conf/httpd.conf, find: <Directory "/var/www/html"> ... </Directory>, modify AllowOverride None to AllowOverride All, then restart httpd.