So I have found these two questions:
Accessing original URL in IIS7 404 redirect page Get URL of page requested that caused a 404
but they are both in diffe
Can't it be in $_SERVER['HTTP_REFERER'] variable?
See http://php.net/manual/en/reserved.variables.server.php