appending GET string to mod_rewrite

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
maliskoleather
Forum Contributor
Posts: 155
Joined: Tue May 15, 2007 2:19 am
Contact:

appending GET string to mod_rewrite

Post 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?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

They will still show up in $_GET either way. Any reason you need them in the rewrite path?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You may be looking for the QSA flag.
User avatar
maliskoleather
Forum Contributor
Posts: 155
Joined: Tue May 15, 2007 2:19 am
Contact:

Post by maliskoleather »

feyd wrote:You may be looking for the QSA flag.
thanks. totally forgot about that one.
Post Reply