Recover typed URL

Asked

Viewed 131 times

1

I have a system that uses Session which expires with inactivity. Access to files in the system is only released after the session is opened. Until then beauty, is working. I would like to remember the link that was typed in the browser URL (address bar) for example http://sistema.empresa.com.br/public/anexo/documentox.pdf. I made a code here, but it does not return me to the expected result. It returns to the folder "public". You would have to store in the $url_browser variable, the exact string of the address bar. Follow the code.

 $url_browser = $_SERVER['SERVER_NAME'].$_SERVER["REQUEST_URI"];
 //aqui executa o processo de login...
 header('Location: ' . $url_browser);

2 answers

4


Can you try :

 $url_browser = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
 //aqui executa o processo de login...
 header('Location: ' .$url_browser);

1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.