Block a visitor's IP address from viewing a webpage or website with the PHP snippet below.
Block a user agent from viewing or crawling a webpage or website with the PHP snippet below.
Code:
<?php
if ($_SERVER['REMOTE_ADDR']=="90.6.400.191"){
echo "You do not have permission to view this page";
exit();
}
?>
Block a user agent from viewing or crawling a webpage or website with the PHP snippet below.
Code:
<?php
if ($_SERVER["HTTP_USER_AGENT"]=="googlebot"){
echo "You do not have permission to crawl this page";
exit();
}
?>