I have a problem with RewriteCond

I have a problem with RewriteCond. I admit that I don’t know how to use these directives (or maybe I haven’t searched enough).

I have a URI like this:


Each time you click on the picture, another picture is uploaded.

id = page id photo = photo id

How can I change this ugly path into something more beautiful, like this:


Any suggestions would be helpful. Thanks!