Redirects and links

My actual implementation of this is much more complicated, with authentication and many other things, but in the simplest form, a problem arises here. A redirect with a heading does not appear as a referent.

So let's say I have three pages: start.php, middle.php and end.php

start.php

<html><body>
<a href="middle.php">middle</a>
</body></html>

middle.php

<?php
header('Location: end.php');
?>

end.php

<?php
    echo 'The referer is: ' . $_SERVER['HTTP_REFERER'];
?>

When you follow the link, you end up with end.php, but the referent is not middle.php. Is there any other redirect method I can use to fix this, or anything else I can do?

Greetings

. , , - URL. . , URL-. - , http_referer?

+3
6

. , URL- , . , , - .

0

, - , - . , .

php bug ( ).

+3

HTTP_REFERER ( ), , . .

, $referring_url = $_SESSION [ "referring_url" ]. $_SESSION [ "referring_url" ] = $current_absolute_url; .

, , concurrency. ( , , AJAX) , , .

+1

SO ( ), , , .

GET - ?

0

- :

header('Location: end.php?from=' . urlencode($_SERVER['PHP_SELF'));

, , ​​:

echo 'redirected from ' . urldecode($_GET['from']);
0

Referrer ?

/ . , Referrer , .

0
source

Source: https://habr.com/ru/post/1778431/


All Articles