I have some URLS I want to rewrite them. I tried to do it myself for long time but couldn't do it, it didn't work for some reason.

1) Real URL: http://mysite.com/?name=Daft_Punk&dir=albums
I want to change it to: http://mysite.com/artist/Daft_Punk/albums

2) Real URL: http://mysite/?name=Daft_Punk&dircon...album=Homework
I want to change it to: http://mysite.com/album/HomeWork

How I can do it?