Mod-Rewrite: This should be easy but...

Giganews Newsgroups
Subject: Mod-Rewrite: This should be easy but...
Posted by:  Confused (confus…
Date: Tue, 22 Jul 2008


I've been asked to provide code to remove the PageNum from a
querystring when the PageNum is zero (this is just to avoid the wratch
of Google accusing the site of having duplicate pages).

In other words
  mypage.php?a=45?PageNum=0 => mypage.php?a=45

any other PageNums should be left alone.

I can't get it to match past the '?'

  ^mypage\.php?$  matches OK, but
  ^mypage\.php\?$ does not and
  ^mypage\.php?a$ does not and neither does

I was originally hoping something like this would work:

  ^mypage\.php\?a=([0-9]+)&PageNum=0$ /mypage.php?a=$1 [R=301,L]

Can anyone help?