header('Location: /page-name/?var1=' . $_GET['var1'] . '&var2=' . $_GET['var2'] ); exit();
The result of the above code ends up redirecting the site to:
I have a feeling Wordpress is cleaning the ampersand in the URL, but I don't at what point it would do that...
Edit: With Milo's direction, I modified the redirect code to look like this and it started working properly.
$url = '/page-name/'; $args = array('var1'=>$_GET['var1'], 'var2' => $_GET['var2']); $url = add_query_arg($args, $url); wp_redirect($url); exit();
I'd still like to know why the ampersand got converted to HTML in the first place.