unable to capture GET parameters with mod_rewrite rule

Giganews Newsgroups
Subject: unable to capture GET parameters with mod_rewrite rule
Posted by:  yawnmoth (terra10…@yahoo.com)
Date: Wed, 21 Jul 2010

RewriteRule ([0-9]+)/index\.php\?var=(.+) /path/to/test.php?a=$1&b=$2

That doesn't work.  It redirects to /path/to/test.php only so long as
there's nothing after the \.php part.  ie. it's as though the ?
character, escaped though it is, is breaking it.

RewriteCond %{QUERY_STRING} var=(.+)
RewriteRule ([0-9]+)/index\.php /path/to/test.php?a=$1&b=$2

That doesn't work either.  It seems I can capture in RewriteCond but I
can't use what I captured anywhere else it seems.

Any ideas?

Replies