Jump to content

I need to redirect by cookie to another domain - multi-store


gusman126

Recommended Posts

I need to redirect by cookie to another domain - multi-store

I have this code.

public function hookdisplayHeader()
{
	$URL_P = $_SERVER['REQUEST_URI'];
	$cookie = $this->context->cookie->forced_zone;
	$dominiourl =$_SERVER['SERVER_NAME'];
	if(!$cookie){
		$cookie = 2;
		$this->context->cookie->forced_zone = 2;
	}
	switch ($cookie) {

		case '1':
			if ($dominiourl != 'domain.1'){
				header("Location: domain.1/".$URL_P);
			}
			
		case '2':
			if ($dominiourl != 'domain.2'){
				header("Location: domain.2/".$URL_P);
			}
	}

}

The problem I find is that it doesn't stop looping when trying to redirect.
Using IP works correctly.
Using forced redirection works correctly
Using cookie does not work

Edited by gusman126 (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...