php - Get request page name or url when doing a redirection -


how request page name or uri source page loaded.

explanation below:

index.php

<?php   header('location:target.php'); ?> 

target.php

<?php   // how check here if redirection has happened index.php ?> 

you can use code below

echo $_server["http_referer"]; 

but make sure can exact origin of page can store current url session before doing redirection , read next page.

in origin page

$_session['origin'] = $_server['request_uri']; 

then in next page

echo $_session['origin']; 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -