I have the following form in my index.php:
<form action="index.php" method="GET">
<input name="id" type="text">
</form>
I know that I can change the method to POST, so that googlebot (or any other bot) won't submit this. However I need this to be a GET form.
$_GET["id"]
is submitted (i.e. on index.php?id=123
)I'm looking for a way to prevent googlebot from entering the index.php?id='some random number'
Just do a simple test and return a 404 header. Granted, this is not terribly efficient, but it will work for what you want
if(isset($_GET['id']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Googlebot') !== false) {
header("HTTP/1.0 404 Not Found");
exit;
}