Re: Search Engines and Sessions(Cross Posted to comp.lang.php)

From: Date: Sun, 21 Jul 2002 05:36:18 +0000
Subject: Re: Search Engines and Sessions(Cross Posted to comp.lang.php)
Groups: php.general 
Request: Send a blank email to php-general+get-108706@lists.php.net to get a copy of this message
>I am worried about search engines and sessions. > >If the UA doesn't support cookies the session id is passed through the urls. > >Search engines won't spider pages with a ? in the url because >page.php?sid=bdf4f91bcc71443cd251a7d3eed05c9c and >page.php?sid=5a547f86ea14186942d0305e352d9e41 would be considered different >pages(The search engines robot could go into a continuos loop). > >I only use sessions on all pages but they do nothing if the user hasn't >signed in. > >what would be a good way to not start the session id in the url if the >person had not logged in anyway? The problem is that if you haven't started >a session you can't check for session variables. You have several options: 1. Use robots.txt (Google for Robot Guidelines) to "force" the search engines to specific URLs you want indexed. 2. Attempt to "detect" the major search engines, and give them a sessionless link. Not recommended. They may think you're trying to hide a porn site from them. 3. "Hide" the ? from the search engines, by simply not using ? in your URL. Use / instead, and then your GET data won't be in $_GET, but it will be in $PATH_INFO and $REQUEST_URI (see <?php phpinfo();?>. It will also mess up $PHP_SELF, but it's a small price to pay. :-) php.php/sid/bdf4f91bcc71443cd251a7d3eed05c9c While these will be "different" pages to the search engines, you should be propagating the session ID for the entire search -- IE< the spider will get its own SID, and will keep re-presenting it in the links it continues to traverse. Although, if you time out your sessions faster than the spider travels, you'll lose them. There are probably more ways to skin this cat. -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#108706) next »