url rewriting – 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:

/photos=the-most-appreciated-books-about-fashion-worth-reading&id=2450&photo=3919

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:

/gallery/the-most-appreciated-fashion-books-worth-reading-id2450-photo3919.html

Any suggestions would be helpful. Thanks!