How to pass variables received in GET string through a php header redirect?

First convert the $_GET HTTP variable into a query string using

$query = http_build_query($_GET);

Then append the query string variable to your redirect header

header('location: domain.com'."?".$query);

Done.

Leave a Comment