Hi. I have a little problem with redirecting. Registered users follows this link site.com/reg.php?passkey=1234
but the first the user get redirected to the correct language based on a cookie. I need to keep the passkey variable when the user is redirected. like this ?lang=en_US&passkey=1234
My code so far look something like this:
if (!isset($_GET['lang']))
{
if (isset($_COOKIE['country']))
{
$country = $_COOKIE['country'];
(...)
elseif ( $country == "US" ){
$variables = $_GET;
$variables['lang'] = "en_US";
header('Location: ?' . http_build_query($variables));
exit();
}
This works:
reg.php
reg.php?lang=en_US
reg.php?lang=en_US&passkey=test
reg.php?passkey=test&lang=en_US
but this gives an The page isn't redirecting properly
error
reg.php?passkey=test
I don't understand why this doesn't work when all the other combinations seem to work perfectly.