Check this blog post about Apache mod_rewrite rules:
http://corz.org/serv/tricks/htaccess2.php
The post gives many rewrite rule examples that solve real-life problems.