镜像网站原理解析
镜像网站的危害
intitle是SEO中的高级搜索指令,intitle关键词指令返回的是页面title中包含关键词的页面。Goolge和百度都支持intitle指令。
恶意镜像解决方法
if (document.location.host != "bt.myltd.ltd" && document.location.host != "bt.myltd.ltd" ) {
alert('警告!检测到该网站为恶意镜像站点,将立即为您跳转到官方站点!');
location.href = location.href.replace(document.location.host,'bt.myltd.ltd');
}
将上面代码中的域名改为你网站的首页主地址。
//防止恶意HTTP_USER_AGENT采集
$ua = $_SERVER['HTTP_USER_AGENT'];
$now_ua = array('FeedDemon ','BOT/0.1 (BOT for JCE)','CrawlDaddy ','Java','Feedly','UniversalFeedParser','ApacheBench','Swiftbot','ZmEu','Indy Library','oBot','jaunty','YandexBot','AhrefsBot','MJ12bot','WinHttp','EasouSpider','HttpClient','Microsoft URL Control','YYSpider','jaunty','Python-urllib','lightDeckReports Bot','PHP');
if(!$ua) {
header("Content-type: text/html; charset=utf-8");
die('请勿采集本站,采集者木有小JJ!请正常访问!');
}else{
foreach($now_ua as $value )
if(eregi($value,$ua)) {
header("Content-type: text/html; charset=utf-8");
die('请勿采集本站,采集者木有小JJ!请正常访问!');
}
}
放在入口文件开头即可,但采用这种方法可能会误杀RSS订阅,自己根据需要调整UA头。
本文共 636 个字数,平均阅读时长 ≈ 2分钟
评论