The Bot Project is all about the webmaster community working together to build a picture of what search engine bots are doing, when they're doing it and where they're from.

PHP / Apache installation guide

If you have any issues with these instructions then please take a look in the PHP installation forum.

What we're going to do here is create robots.php and use the Apache RewriteEngine to actually use robots.php.

This means that the code that is required to update The Bot Project can run and your robots.txt file is untouched.

1) In the root of your website directory, create a file called robots.php and paste the following code into it :

<? header('Content-Type: text/plain');

# robots.php for thebotproject.com. Released March 2008. Version 1.0php. Matt Burke

# load in your robots.txt file (must exist)
readfile('robots.txt');
flush();
ob_flush();

#*******THIS IS THE ONLY BIT YOU NEED TO CHANGE*******
# your api key

$apikey = "YOUR-API-KEY"; # <-- you need to add your key inside the quotes

#***********************************************************************

# get agent ip address
if ($_SERVER['HTTP_X_FORWARD_FOR']) {
$ip = $_SERVER['HTTP_X_FORWARD_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}

# get the name of the bot
$botname = $_SERVER['HTTP_USER_AGENT'];

# the url to post results to
$url = "http://stats.thebotproject.com/default.php?api=". $apikey . "&bot=". urlencode ($botname ) ."&ip=". urlencode($ip) ;

# we are using curl to post the results, see forum for alternatives
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url );
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch ,CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $defined_vars['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_exec ($ch);
curl_close ($ch);

?>

2) You should have a .htaccess file in the root of your website.

After RewriteEngineEdit on in your .htaccess file add :

RewriteRule ^robots.txt$ robots.php

Then view your robots.txt file in your browser - it should appear exactly as it did before.

If you get an error then ensure the permissions or ownership are correct on the robots.php file (IE chgrp [relevant owner] robots.php).

Stats are updated every 5 minutes so please don't expect to see something instantly in My Site Statistics.

Please note : we take no responsibilty for screwing up your web server. If you aren't sure what you're doing then please post in the forums before you make changes