|
|
|
|
| Tutorial |
It reveals that your pages are generated dynamically, and some search engines
will refuse to index the pages at all. Other search engines will cut everything
after the question mark from the URL.
n The session ID will be added to users’ bookmarks and printouts.We even know
of articles in technical journals that have the session ID of a Web site included
as part of a reference. From a usability point of view, it’s harder for users to
manually alter the URL to find specific resources on a site.
n The session ID is logged in proxy servers and shows up in the HTTP_REFERER
CGI environment variable for other sites.
Dynamic Paths
Let’s see if we can avoid some drawbacks of URL rewriting. For a start, you can add
the ID to your URL in the Amazon.com way (see Figure 4.1) to make it look like
http://server.com/page.php3/<session-id>.With this method, the session ID is part
of the path to the script, and the URL looks like a static page to search engines and
spiders.This works because the Web server knows that page.php3 is a script, and stops
looking further in the URL for files. But this way the session ID is not automatically
available in your PHP script.You need to parse the path yourself to get access to it:
function session_start_from_path()
{
global $HTTP_HOST, $REQUEST_URI;
ereg(“/([0-9a-z]{32})”, $REQUEST_URI, $regs);
$session_id = $regs[1];
if(!isset($session_id) || empty($session_id))
{
srand((double)microtime()*1000000);
$session_id = md5(uniqid(rand()));
$destination = “http://$HTTP_HOST$REQUEST_URI/$session_id”;
header(“Location: $destination”);
}
session_id($session_id);
session_start();
}
All other drawbacks of URL rewriting still apply to dynamic paths, though.
|
|
|
|
|
|
| Link Partners: Asia florist, Flowers to India, Hong kong flowers, Site submit, Cheap web hosting, China florist, Japan florist |
|