redirect GET form to user friendly URL
06:36 10 Sep 2015

I have a form that redirects my data using GET as a method to this page (seccions/search.php) which redirects me to:

http://host/seccions/search.php?search_term_string=([^/]*)&search_term_on=([^/]*)

And I would like to be redirected once submitted to this other pattern:

http://host/empresas/categoria/$1/poblacio/$2/

I'm trying to accomplish that via .htaccess (as I don't see other easy ways) I try to redirect the ugly URL to the pretty one, that gets later on, on the .htaccess converted to the proper URL pattern using this code:

RewriteRule ^seccions/search.php?search_term_string=([^/]*)&search_term_on=([^/]*)$ empresas/categoria/$1/poblacio/$2/ [L]
RewriteRule ^empresas/categoria/([^/]*)/poblacio/([^/]*)$ seccions/search.php?que=$1&on=$2 [L]

(I know I'm changing the param names and the .php search page is already prepared for different $_GET names)

but once the form gets submitted it just goes to the ugly URL with the GET params in it.

Is there a way to fix it?

Thanks!

html .htaccess