I'm experiencing a weird issue where if I use setcookie() and then use header('Location: ...') the page redirect happens but the URL does not change. The page I redirect to also thinks it's in the same directory as the starting page. So it's behaving more like include(). Any ideas?

    code? or i could guess wildly if you prefer?

      Sorry, I didn't think it was necessary:

      setcookie('homepage', 'buy', time()+60*60*24*365);
      header('Location: /buy/');
      exit;

        I should just post the whole chunk:

        if(!isset($_COOKIE['homepage'])){
        		$rand = rand(0, 1);
        		if($rand == 0){
        			setcookie('homepage', 'home', time()+60*60*24*365);
        		} else {
        			setcookie('homepage', 'buy', time()+60*60*24*365);
        			header('Location: /buy/');
        			exit;
        		}
        	} else {
        		if($_COOKIE['homepage'] == 'buy'){
        			header('Location: /buy/');
        			exit;
        		}
        	}
          Write a Reply...