Good all the time of day.

There is a site that is entered into the browser line, say, http://microsoft.com/ , then the browser jumps to http://www.microsoft.com/en-us/default.aspx .

How, having a url, to determine which page is thrown by the user when entering on ODA. page?

  1. $url_s; // from here we take url
  2. $url_f; // hunt here to put the value of the address after the redirect

    2 answers 2

    You can use JavaScript to monitor location.href and pass the value using the AJAX PHP script. And directly through PHP to implement it IMHO

       <?php @header('Refresh: 3; URL=http://www.microsoft.com/en-us/default.aspx'); echo 'Через 3 сек. вы будете перенаправлены на новую страницу.'; exit; ?> 

      I still did this, once there was a need:

      Request for a page http://test.ru/test_connect.php

       <?php switch ($_REQUEST['CITY']) { case 1: $url = "http://test.ru/test_1.php"; break; default: // Если другое значение $url = "http://test.ru/test_2.php"; } header('Location: ' . $url); exit; ?>