cookies and Google

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

cookies and Google

Post by microthick »

A site I'm developing for a client has an international audience. Because of that, upon first visiting any site that depends on location (for price lists, availability of products, etc.) if no locale is set, the user is requested to select where they are located.

unfortunately, this has the adverse effect of also prompting Google and other search engines to set their locale. i know this cause I've viewed cached versions of the site at Google.

is there a way of knowing whether or not it's a bot or spider visiting the site and if so, defaulting to a specific locale?

links to examples welcome.
tsg
Forum Contributor
Posts: 142
Joined: Sun Jan 12, 2003 9:22 pm
Location: SE, Alabama
Contact:

Post by tsg »

I do something like this to send bots to a different stats file ..

Code: Select all

<?php
$st_remote_host = @getHostByAddr($REMOTE_ADDR);

if((strpos($st_remote_host, "google")) OR (strpos($st_remote_host, "teoma")) OR (strpos($st_remote_host, "alexa")) OR (strpos($st_remote_host, "inktomisearch"))== true) {

// this is where I do whatever, you could probably do a header to a different page for bots
}
?>
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post by microthick »

thanks tsg. i'll look into that idea.
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post by microthick »

The only problem I have with tsg's approach is that I have to maintain a list of bots that visit my page.

Is there any way to distinguish a normal visiter from a spider?
Post Reply