Is it possible to determine whether the redirect was without recording the session, etc.? Type as POST request:

if(isset($_POST['post'])) { echo 'запрос выполнен'; } else { echo 'запрос не выполнен'; } 
  • one
    You can watch $ _SERVER ['HTTP_REFERRER'] - ling
  • By the way, idea if to compare so $ _SERVER ['HTTP_REFERRER'] == $ _SERVER ['REQUEST_URI'] - Palmervan
  • one
    $ _SERVER ['HTTP_REFERRER'] exists only when a link is being followed and not a redirect through header ('Location: ...'); - Barton
  • Already tested, understood) - Palmervan

1 answer 1

You can try this: index.php:

 header('Location:test.php?ref=1'); 

test.php:

 if ((isset($_GET['ref']) && ($_GET['ref']=='1')){ echo 'Redirect from index.php'; } else { echo 'Without redirect'; } 

If you follow the link, you can see the value of $ _SERVER ['HTTP_REFERER'].

  • The point is that $ _GET should not be used! - Palmervan
  • well and on another through header in any way. It is possible to make a request via ajax post and pass by parameter what the redirection was. - Barton
  • You can simply record a session, redirect and reconcile the session after the redirection. It was just wondering if the redirection can be handled by some method. Thanks to all. - Palmervan