I have not good idea about url masking. I know this is possible to make Current url to Target url but don't know how to do it for dynamic url. Is it possible to make the masking with php code.
Current url: http://domain.com/product?id=123&cat=2
Target url: http://domain.com/product/123/2
you must use mod_rewrite
Apache
like this
RewriteCond %{QUERY_STRING} ^id=([0-9]*)$
RewriteRule ^page\.php$ http://mydomain.site/page/%1.php [R=302,L]