Page 1 of 1

appending GET string to mod_rewrite

Posted: Tue Jun 26, 2007 12:05 am
by maliskoleather
this really has me stumped for some reason. Im using mod_rewrite to make pretty url's... turning something like

Code: Select all

http://sample.com/admin/index
into

Code: Select all

http://sample.com/admin.php?page=index
using

Code: Select all

RewriteRule ^admin/([^/]+) admin.php?p=$1
which works great. my issue is, i want to add some extra GET data to the url, and append that to the end of the rewritten url.. ie:

Code: Select all

http://sample.com/admin/index?foo=bar&bat=baz
into

Code: Select all

http://sample.com/admin.php?page=index&foo=bar&bat=baz
my rule so far is

Code: Select all

RewriteRule ^admin/([^/]+)/\?(.*) admin.php?p=$1&$2
anyone know where i'm messing up?

Posted: Tue Jun 26, 2007 12:13 am
by Benjamin
They will still show up in $_GET either way. Any reason you need them in the rewrite path?

Posted: Tue Jun 26, 2007 12:19 am
by feyd
You may be looking for the QSA flag.

Posted: Tue Jun 26, 2007 12:26 am
by maliskoleather
feyd wrote:You may be looking for the QSA flag.
thanks. totally forgot about that one.