Q:

How to get values from query string and pass it to new page using .htaccess file

currently I m using following code in my site in .htaccess file :
RewriteRule ^([^/\.]+).php?$ comman.php?cat=$1 [L]

This redirects user to comman.php page say, user requests
http://www.mysite.com/myfolder/page1.php
will redirects to 
http://www.mysite.com/myfolder/comman.php?cat=page1
This works fine. My question is how can I achieve following
http://www.mysite.com/myfolder/page1.php?var1=123
to redirect
http://www.mysite.com/myfolder/comman.php?cat=page1&param=123
i.e. whatever value passed to url using get method to add in my new url.
Thanks in Advance.....

A:

You should add the QSA flag:
RewriteRule ^([^/\.]+).php?$ comman.php?cat=$1 [L,QSA]

QSA stands for Query String Append. Anything after the ? in the original URL will be appended to the rewritten URL.

