How to send a query string using htaccess?

I am currently using this to rewrite URLS:

RewriteEngine on RewriteRule ^([^/?\.]+)$ /page.php?name=$1 [NC] 

So mysite.com/home chatting to mysite.com/page.php?name=home

How can I do this also rewrite mysite.com/home?param=value to mysite.com/page.php?name=home¶m=value ? Ideally, I would like this to work for any pairs with number names / values.

Am I missing something obvious?

+2
source share
2 answers

Check out the “capturing variables” section at http://corz.org/serv/tricks/htaccess2.php

It says that if you add [QSA] at the end of the rewrite rule, it must pass the variables through rewriting.

+3
source

This made it work:

 RewriteEngine on RewriteRule ^([^/?\.]+)$ /page.php?name=$1&%{QUERY_STRING} [NC] 
+1
source

All Articles