我将此代码添加到 opencart 系统上的 index.php 中。
if(!strstr(strtolower($_SERVER['HTTP_USER_AGENT']), "googlebot"))
{
if($_SERVER["HTTP_CF_IPCOUNTRY"] =! 'UK')
{
echo "You can not see this page.";
die();
}
}
但我可以看到这个页面有来自其他国家的代理网站。我只想让 My Country IP 和 googlebot 看到这个页面。