View Single Post
Old 2004-06-30, 12:42   Link #3
NightWish
…Nothing More
*Administrator
 
 
Join Date: Mar 2003
Age: 44
As Lefteris_D said, the server variable "path_info" is often used to improve search engine compatibility. Until recently very few search engines supported trawling web documents that could only be accessed via links that passed information in the "query_string"; a notable exception to this being Google.

This meant that pages using information after the "?" in the URL would not be seen and would hence not be indexed by the spider. That or they would be requested without the query information; resulting in a "default" page view regardless of context or possibly just meaningless errors -- all of which would just "poison" the search engines database. Using the path_info you get around this by passing the required information in the already supported "path" component of the URL.

It is also considered more esthetically pleasing; "viewdoc/100.html" looks nicer and is often easier to remember than "viewdoc.php?document_id=100". This becomes even more powerful when you have lots of other variables.

For example; on this forum a url like:
http://forums.animesuki.com/showthread.php?t=12345&page=5
Could look much better as:
http://forums.animesuki.com/showthread/12345/5.htm
Note: You don't need the ".php" if the server is configured "correctly".
If the software supported it...

Once you're aware of it you'll notice it on many more sites; like Amazom for example. They often put session id information in the URL in such a way that all the links on the page "auto-magically" pick up the session id, thus maintaining the session even if you don't have cookies enabled. I believe a lot of JSP applications do the same.

P.S. If you are using a version of PHP greater than 4.1.0 (which you really should be by now) you don't want to use the "$HTTP_SERVER_VARS" at all, you want to use the super-global "$_SERVER" instead; as the former is deprecated .

Last edited by NightWish; 2004-06-30 at 12:59. Reason: Added PS.
NightWish is offline   Reply With Quote