Forum Moderators: phranque

Message Too Old, No Replies

rewrite stopping get parameters coming through

         

cainmi

2:42 am on Sep 11, 2008 (gmt 0)

10+ Year Member



Hey guys,
I'm using the following rule in my .htacces (among others):

RewriteRule ^(001¦002¦003)/foobar/$ foobar/index.php?code=$1 [L]

This works great, enabling any requests to www.mysite.com/002/foobar/ to go through to www.mysite.com/foobar/index.php?code=002, which is what I want.

However, if a user goes to www.mysite.com/002/foobar/?user=booyah, then I would like that parameter passed too (so www.mysite.com/foobar/index.php?code=002&user=booyah), but it doesn't.

The paramters that may appear in the url may be there, or may not, and also will vary greatly.

Can anyone help with how I change my rewrite rule?

Cheers,
Mitch.

cainmi

2:58 am on Sep 11, 2008 (gmt 0)

10+ Year Member



Ah ha!

RewriteRule ^(001¦002¦003)/foobar/$ foobar/index.php?code=$1&%{QUERY_STRING} [L]

jdMorgan

1:14 pm on Sep 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For an easier method, see the [QSA] flag for RewriteRule. Without [QSA], a new query string specified in a RewriteRule substitution will replace the incoming query string.

Jim