1

I have a URL like this

http://www.domain.com/#movies

The url is redirected after an authentification filter to

http://www.domain.com/login#movies

Which contains a login form, I want to redirect the user, after login successful, back to

http://www.domain.com/#movies

Or at least read the part after the hash to see the original requested URI. I have to mention that the hash has something to do with ajax, to load only what changed in the page, this is done by a front-end developer and I'm the back-end developer. I tried $_SERVER['HTTP_REFERER'] and $_SERVER['REQUEST_URL'] but neither worked.

Amaynut
  • 4,091
  • 6
  • 39
  • 44
  • 1
    You can't. That fragment is not sent to the server. Consider using a query string `?movies` or `?redir=movies` or something. Possibly have the front-end developer set a cookie that you can read with `$_COOKIE`. – AbraCadaver Jan 16 '15 at 15:49
  • You could get the part of the URL after the hash via javascript and pass it as a variable in your AJAX request. Something like that: var ajax_url = '/example.php?test='+window.location.hash.replace('#',''); – Samuil Banti Jan 16 '15 at 16:02

0 Answers0