I'm facing a very strange behavior and hope to get your help and the solution or explenation for it.
I do use a very simple code on a page:
// start a session
if( !session_id() )
session_start('');
// write current url in session to prepare redirect after login
$_SESSION['url_before_login'] = $_SERVER['REQUEST_URI'];
On the same page I do load a favicon, which currently is missing. So, on the console of the browser i get this error message:
GET https://my.domain.ltd/assets/favicon/apple-touch-icon.png [HTTP/2 404 Not Found 141ms]
This is fine. But, the strange behavior is, my variable $_SESSION['url_before_login']
does not have the $_SERVER['REQUEST_URI']
of my page but the $_SERVER['REQUEST_URI']
of the missing file.
When I output the $_SESSION['url_before_login']
I do get /assets/favicon/apple-touch-icon.png
instead of /folder/sub-folder/
.
If there is no loading error and no missing file, the $_SESSION['url_before_login']
shows me the right URI.
Does anyone know this behavior and has a solution how to fix this (beside making sure not to have a missing file ;-)).