How to get the request page name or uri from which the source page is loaded.
Explanation below:
index.php
<?php
header('Location:target.php');
?>
target.php
<?php
// How to check here if the redirection has happened from index.php
?>
How to get the request page name or uri from which the source page is loaded.
index.php
<?php
header('Location:target.php');
?>
target.php
<?php
// How to check here if the redirection has happened from index.php
?>
you can use the code below
echo $_SERVER["HTTP_REFERER"];
but to make sure you can get really the exact origin of your page you can store the current url to a session before doing a redirection and read it to the next page.
in the origin page
$_SESSION['origin'] = $_SERVER['REQUEST_URI'];
then in next page
echo $_SESSION['origin'];