If you’re actually using URLs like /my_page.php?cat=14&p=1
and want them to be “displayed” as /my_page/14/1
, you will need two rules: One to redirect /my_page.php?cat=14&p=1
externally to /my_page/14/1
and one to rewrite /my_page/14/1
internally to /my_page.php?cat=14&p=1
.
RewriteCond %{THE_REQUEST} ^GET\ /my_page\.php\?
RewriteCond %{QUERY_STRING} ^cat=([0-9]+)&p=([0-9]+)$
RewriteRule ^my_page\.php$ /my_page/%1/%2 [L,R=301]
RewriteRule ^my_page/([0-9]+)/([0-9]+)$ my_page.php?cat=$1&p=$2 [L]
Note that this rule does only work with this specific URL (number and order or parameters). A more general rule will get more complex; using a higher level language like PHP is probably easier in this case.
Furthermore, it would be better if you already use the “right” URL in your HTML documents rather than redirecting/rewriting every request twice.