Jump to content

Robot accomidation


samoht

Recommended Posts

Hello all,

 

I have a SEO problem because I have setup a quick form on my index.php for the user to set a session variable. Once set the user is introduced to the content of the site - based on his session var he may or may not see a few items. I need to be able to send the robots passed the form with the session var set to "USA"

 

How can I do that??

 

Thanks,

Link to comment
https://forums.phpfreaks.com/topic/185609-robot-accomidation/
Share on other sites

So could I:

session_start();
if(strstr(strtolower($_SERVER['HTTP_USER_AGENT']), "googlebot"))
{
$_SESSION['country'] = "USA";
header ('Location: http://www.mywebpage.com/index.php');   
}
// ... rest of the code

??

I assume that will work but what if I want a list of robot names?

Can I create an array and just stick it in my condition?

 

Also regarding the robot names: - does "Slurp" work for yahoo, or do I need to specify the name like

Slurp.so/1.0

Slurp/2.0j

Slurp/2.0

Slurp/3.0

??

 

Thanks,

Link to comment
https://forums.phpfreaks.com/topic/185609-robot-accomidation/#findComment-980564
Share on other sites

So I tried:

session_start();
$bots = array ('Googlebot','MSN','Slurp/3.0','Slurp.so/1.0','Slurp/2.0j','Slurp/2.0','Scooter','Scrubby');
if(strstr(strtolower($_SERVER['HTTP_USER_AGENT']), $bots))
{
$_SESSION['country'] = "USA";
header ('Location: http://www.mywebsite.com/index.php');   
}

 

but that doesn't seem to work.

 

where this:

session_start();
if(strstr(strtolower($_SERVER['HTTP_USER_AGENT']), "googlebot"))
{
$_SESSION['country'] = "USA";
header ('Location: http://www.mywebsite.com/index.php');   
}

works for the Googlebot/2.1

Any idea why??

Link to comment
https://forums.phpfreaks.com/topic/185609-robot-accomidation/#findComment-980576
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.