Added TODO section discussing how to make this solution more flexible with a catchall RewriteRule and more processing pushed onto the script.