2

I'm trying to use CodeIgniter for AB Testing, but this is a first for me, so please forgive the newbie question.

I have found that in index.php I can control which applications folder to present to a user based on the following:

if(isset($_SESSION['subsite']))
{
        $application_folder = "application".$_SESSION['subsite'];
}
elseif(rand(1,2) % 2)
{
        $application_folder = "application";
        $_SESSION['subsite'] = '';
}
else
{
        $application_folder = "application_old";
        $_SESSION['subsite'] = '_old';
}

However, this will redirect all traffic without any indication of a redirect. I am concerned that SEO can take a dive with this method as Google and other bots will be continually seeing different versions of the site. Can someone please provide the appropriate procedure for this. Thanks.

user2694306
  • 3,832
  • 10
  • 47
  • 95

1 Answers1

0

You can check if the user agent string to determine if a visitor is a search engine crawler.

User agent string is stored in $_SERVER['HTTP_USER_AGENT'] in PHP. You can check out this SO post for more information: how to detect search engine bots with php?

Community
  • 1
  • 1
DashK
  • 2,640
  • 1
  • 22
  • 28