I've two domain names, domain.com and primary.com. I have to visit primary.com and go back to domain.com

How you can do these redirects without looping? And That I can`t add GET parameter.

domain.com &rarr primary.com &rarr domain.com

Look into the referrer.

You should use the header function in the page you need to redirect with a other location:

header('LOCATION: url/page here');exit;

domain.com/get - within this point you can include some additional variable then when you get into domain.com take a look variable, if the varaible is available on GET then do not get into primary.com/send

If you work with header() to alter location, you can include in url some get variable like for instance index.php?x. You'll be able to check isset($_GET['x']) for obtain information on this.

You cannot do that within this form.

I discovered not one other solution except this:


  setcookie('flag', 1, time() + 100, "/");
  header('location: http://main.com');
  setcookie('flag', '', time() , "/");
  echo 'done!';


header('location: http://domain.com');