I have an image gallery that generates album and image URLs each time an album and/or image is added. The generated album URLs are like this:

In one of my SQL tables I have an Album Name row as `al_name`

I want URLs like index.php?page=list-image&album=1 to be rewritten by printing out /$row
So, the rewritten URL will look similar to /Best_Wedding_Photos/ if the Album Name is: Best Wedding Photos

Likewise, I need your help to rewrite the likes of the URLs below:

I would like the likes of the these image URLs to be rewritten as:
/Best_Wedding_Photos/image-1.html if the Album Name is: Best Wedding Photos and image=1

Your help is much appreciated in advance.

Hi everyone, this issue still persists and I would be glad if someone can kindly come along to look into it and probably bring a solution. I'm literally stuck with this for a long time now. Thanks in advance.