I think I know what you're asking. Here is a snippet that will produce the complete URL for the current PHP script, including the query string:
$full_url = ($_SERVER['HTTPS'] == "on" ? "https://" : "http://") . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
echo $full_url;
And if you just want the query string on the end, i.e. cat=&rows=10&page=2
, you can use:
echo $_SERVER['QUERY_STRING'];
So I believe in your case what you're looking for is something like this:
$full_url = ($_SERVER['HTTPS'] == "on" ? "https://" : "http://") . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header("Location: ".$full_url);