I am using a "Pretty URL", and would like to capture it, and store it in $_SESSION['returnToPage'], so that when I later call it, I will be taken back to the page I was on.
How would I do that?
Here are a few "Pretty URL's" that I might want to capture...
Have you already tried $SERVER['HTTPREFERER'] ?
You would use $SERVER['REQUESTURI'] to capture it and stuff it into a session before you move to the next page. Don't use HTTP_REFERER, it is not guaranteed to be available or not contaminated.
Ok, some follow-up questions...
1.) So, is $SERVER['REQUESTURI'] safe to use from a security standpoint?
2.) Will $SERVER['REQUESTURI'] capture any "Pretty URL" scheme that I might have?
3.) Is there any conflict between $SERVER['REQUESTURI'] and my "Pretty URLs" and the "Ugly URL" that my mod_rewrite is creating?
Is REQUEST_URI safe...no (depends on you use it) but it is the only thing available, as it is what the server provides and uses itself.
REQUEST_URI is whatever is used as the address the client uses within the HTTP request so yes.
No conflict because the server (mod_rewrite) is using REQUEST_URI to match pretty URIs to their real URIs.
Example HTTP request:
<font color='#000000'><font face='monospace'>GET [B]/fancy/pretty/URI/here/access/with/REQUEST/URI/on/server.html[/B] HTTP/1.1
Okay, I think that answers my question. (Now if I can just figure out how to solve my Content-Architecture dilemma?!)
This topic is now closed. New replies are no longer allowed.