Page is a not externally linkable
g1smd - 8:12 pm on Mar 3, 2011 (gmt 0)
example.com/abcdef/uvwxyz
gets the 302 redirect.
That URL request will be matched by this pattern:
RewriteRule ^([^/.]+)/([^/.]+)$ index.php?uid=$1&pid=$2&gid=$3 [L]
and will be rewritten to:
index.php?uid=abcdef&pid=uvwxyz&gid=<blank>
Your script should be checking that $1, $2 and $3 are valid values and then constructing the correct 404 header and error message HTML page if they are not.
One problem is that $3 is always blank. What your script does with that malformed request is anyone's guess, but may be linked to the problem you are having now.