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?
Thanks,
Debbie
| SitePoint Sponsor |





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?
Thanks,
Debbie





Here are a few "Pretty URL's" that I might want to capture...
http://local.debbie/articles/rate-this-article/postage-meters-can-save-you-money
http://local.debbie/articles/edit-comment/postage-meters-can-save-you-money/DoubleDee/2
Thanks,
Debbie
Have you already tried $_SERVER['HTTP_REFERER'] ?
You would use $_SERVER['REQUEST_URI'] 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['REQUEST_URI'] safe to use from a security standpoint?
2.) Will $_SERVER['REQUEST_URI'] capture any "Pretty URL" scheme that I might have?
3.) Is there any conflict between $_SERVER['REQUEST_URI'] and my "Pretty URLs" and the "Ugly URL" that my mod_rewrite is creating?
Thanks,
Debbie
1. 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.
2. REQUEST_URI is whatever is used as the address the client uses within the HTTP request so yes.
3. No conflict because the server (mod_rewrite) is using REQUEST_URI to match pretty URIs to their real URIs.
Example HTTP request:
Code:GET /fancy/pretty/URI/here/access/with/REQUEST/URI/on/server.html HTTP/1.1 HOST: exmaple.com ...





logic_earth,
Okay, I think that answers my question. (Now if I can just figure out how to solve my Content-Architecture dilemma?!)
Thanks!
Debbie
Bookmarks