I have two type domain and want to rewrite it for friendly URL.

**1. The first:**

> https: //mydomain.ltd/folder/myfile.php?id=xx&param1=yy

I want it rewrite to:

> https: //mydomain.ltd/folder/myfile/xx/yy


**2. The seconds:**

> https: //mydomain.ltd/folder1/myfile.php?id=xx&param1=yy

I want it rewrite to:

> https: //mydomain.ltd/myfile/xx/yy

*Please help me how to do it. I've searched from google but I do not understand the principle rewrite.
Thank you verymuch!*