网站被恶意镜像怎么办 php一段代码轻松搞定(全面版)


Posted in PHP onOctober 23, 2018

有时候你会发现,你在搜索引擎输入网站名称的时候,出来的网站信息是你们的,但是域名却是一个陌生的,这种情况可以基本确定网站被镜像了,那么究竟什么叫网站被镜像?

恶意镜像,也叫恶意克隆,恶意解析,是指有人通过域名 A 记录直接解析别人 IP 地址,从而得到一个在访问者眼中完全相同网站的过程。其工作原理基本上是这样子的:有用户访问镜像站点时,程序就会来正版的站点查询数据,并修改相关链接然后呈献给用户,实质上还是在读取原站的数据。严谨一点的解释:通过复制整个网站或部分网页内容并分配以不同域名和服务器,以此欺骗搜索引擎对同一站点或同一页面进行多次索引的行为 。

网站被镜像的危害

通俗的讲,恶意镜像者意图利用自己有一定权重的域名进行威压,通过某些手段复制了你的站点,除了域名不一样之外,其他内容一模一样,用户或许根本无法分辨。甚至对于一些新的站点,搜索引擎都会迷惑到底哪个是真的站点,那么就有可能正牌的网站被删除收录,而盗版的却被搜索引擎青睐。

虽然目前我们还不知道恶意镜像我们的网站到底有什么意图,但肯定对我们没什么好处,如果他这个域名有点什么不健康的信息,那么我们被镜像的站点有可能被污染掉,所以还是要警惕这个现象。

如何知道自己的网站是否被镜像

复制自己网站的完整标题(PS:查看自己站点首页源码,其中 <title>龙笑天下 - 分享悲伤;共享快乐</title>),然后在谷歌和百度等搜索引擎里搜索,如搜索:intitle 龙笑天下 - 分享悲伤;共享快乐,如果有其他网站的网站标题、描述及网站内容跟你的一样,只有域名不一样,那就是被镜像了。

如何处理网站被镜像

这类镜像看似一个完整的站点,其实上是每次用户访问镜像站点,程序就会来正版的站点查询数据,并修改相关链接然后呈献给用户。实质上还是在读取原站的数据。以下龙笑天下就列举几种解决方法,大家自行取舍使用!

方法 1:查清镜像网站的主机 Ip,通过禁止 Ip 来解决

本教程基于 WordPress 程序,其他系统请自测!

1、获取镜像服务器 ip。注:这个 IP 可能不是 ping 到他域名的 IP

复制如下代码,新建一个 php 文件,并命名为“ip.php”上传到你的网站根目录。

<?php
$file = "ip.txt"; //保存的文件名
$ip = $_SERVER['REMOTE_ADDR'];
$handle = fopen($file, 'a');
fwrite($handle, "IP Address:");
fwrite($handle, "$ip");
fwrite($handle, "\n");
fclose($handele);
?>

<?php
$file = "ip.txt"; //保存的文件名
$ip = $_SERVER['REMOTE_ADDR'];
$handle = fopen($file, 'a');
fwrite($handle, "IP Address:");
fwrite($handle, "$ip");
fwrite($handle, "\n");
fclose($handele);
?>

2、然后访问你网站的镜像站点,在地址后面加.../ip.php,然后你就会在网站根目录找到 ip.txt 文件了,打开复制里面的 ip 地址。

3、然后打开你的.htaccess 文件,在后面加上如下代码(自行修改为刚刚获得的 ip)

#添加IP黑名单
Order Deny,Allow
Deny from 162.158.72.179

#添加IP黑名单
Order Deny,Allow
Deny from 162.158.72.179

当然,如果你使用 CDN,可以直接在 CDN 后台添加 ip 黑名单

这个时候你再刷新一下镜像站点,是不是已经 403 报错了呢?这个时候已经解决了这个镜像站点,然后就等待蜘蛛将其解决掉吧。

此方法的缺点就是如果镜像网站更换了 ip,那我们的屏蔽就失败了

方法 2:JS 来防护

在头部标签:取自 @boke112 导航

<head></head>

<head></head>

里加上下面的 JS 代码:

<script type="text/javascript">
if (document.location.host != "www.ilxtx.com") {
location.href = location.href.replace(document.location.host,'www.ilxtx.com');
}
</script>

<script type="text/javascript">
if (document.location.host != "www.ilxtx.com") {
location.href = location.href.replace(document.location.host,'www.ilxtx.com');
}
</script>

或加上以下的 JS 代码:

<script type="text/javascript">
rthost = window.location.host;
if (rthost != "www.ilxtx.com") {
top.location.href = "https://www.ilxtx.com";
}
</script>

<script type="text/javascript">
rthost = window.location.host;
if (rthost != "www.ilxtx.com") {
top.location.href = "https://www.ilxtx.com";
}
</script>

注意:将上面代码中的www.ilxtx.com改为你网站的首页主地址,如果我上面填写的不是我网站的主地址 www.ilxtx.com,而是 ilxtx.com 的话,就会导致网站一直刷新!

注:经过本站测试,如果镜像站屏蔽了 JS,则该方法失效。所以,最好把方法 2 和方法 3 结合使用!

方法 3:Js 被屏蔽后防止镜像的方法

将以下代码加到网站的 header.php 中:代码取自 @boke112

<div style="display:none;">
<script>proxy2016 = false;</script>
<img src="" onerror='setTimeout(function(){if(typeof(proxy2016)=="undefined"){window.location.host="www.ilxtx.com";}},3000);'>
</div>

<div style="display:none;">
<script>proxy2016 = false;</script>
<img src="" onerror='setTimeout(function(){if(typeof(proxy2016)=="undefined"){window.location.host="www.ilxtx.com";}},3000);'>
</div>

有些网站会屏蔽掉 JS 代码(如下面的代码) :

<script>...</script>
<script>...</script>

所以 <script>proxy2016 = false;</script> 代码将被过滤掉,img 的 onerror 设置超时时间 3000 毫秒,将运行函数部分,检测是否还存在 proxy2016 字符,如果没有找到就会将主机的 URL 改为 www.ilxtx.com;为了安全起见,将 js 部分可以使用 js 代码混淆(本站“JS 代码混淆” 工具 或 站长之家 JS 混淆工具)。
本站的混淆结果如下:

<div style="display:none;">
<script>proxy2016 = false;</script>
<img src=" " onerror='setTimeout(function(){if(typeof(proxy2016)=="undefined"){window["\x6c\x6f\x63\x61\x74\x69\x6f\x6e"]["\x68\x6f\x73\x74"]="\x77\x77\x77\x2e\x69\x6c\x78\x74\x78\x2e\x63\x6f\x6d";}},3000);'>
</div>

<div style="display:none;">
<script>proxy2016 = false;</script>
<img src=" " onerror='setTimeout(function(){if(typeof(proxy2016)=="undefined"){window["\x6c\x6f\x63\x61\x74\x69\x6f\x6e"]["\x68\x6f\x73\x74"]="\x77\x77\x77\x2e\x69\x6c\x78\x74\x78\x2e\x63\x6f\x6d";}},3000);'>
</div>

经过我的测试,此代码在 Chrome、IE11 和 360 极速浏览器上均有效,会跳转到源站的原文章页!在 Firefox 上则无效果,镜像的文章页并不会跳转到原站...... 将代码中 img 标签的 src 引用地址改为空格或无效的图片地址后,在 Firefox 上也起作用了!

方法 4:借助 Img 的 Onerror 事件

20161119 更新(增加搜狗快照支持):此方法使用了后,会导致百度快照、谷歌快照、必应快照和搜狗快照等跳到 404 页面(360 搜索快照则不会~),奈何不知怎么弄,2016-11-10 再次经过张戈的指导,将原代码中的:if( str1!=str3 ) 改为 :if( str1!=str3 && str3!="cache.baiducontent.com" && str3!="webcache.googleusercontent.com" && str3!="c.360webcache.com" && str3!="cncc.bingj.com" && str3!="snapshot.sogoucdn.com" ) 。估计要等快照更新时才能知道效果了!

20161127:经过验证,上述更新已经起作用了!具体效果,请点我~

20171022 更新:从张戈那看到,这段代码会因为 onerror 死循环造成浏览网页的电脑高负载(CPU 飙升),因此在代码 onerror 触发事件中加入 onerror 清空机制,即加入this.onerror=null。【博客网页导致电脑 CPU 飙升的问题解决记录】

通过拆分域名链接与镜像站比对,然后用 img 标签 src 空值触发 onerror 来执行 js 比对,比对失败则跳转回源站。

①、WordPress 专用版

经过 @张戈 童学的不断改进(IE 不支持 window.stop() 函数,所以“20160909 版本”失效...),已经完美的适配 Firefox、Chrome、IE11 和 360 极速浏览器,而且可以跳转至源站的相应文章页,在此衷表感谢!下面 3 段任选一个即可。效果请看这里:http://www.ilxtx.com.3s3s.org/the-shawshank-redemption-1994.html

代码如下:(复制粘贴到主题的 functions.php 最后一个?>之前)

/**
* 网站被恶意镜像怎么办 一段代码轻松搞定(全面版) - 龙笑天下
* https://www.ilxtx.com/mirrored-website.html
* 最后更新时间:20171022  发布时间:20160912
* 出自:zhangge.net
*/
add_action('wp_footer','lxtx_deny_mirrored_websites');
function lxtx_deny_mirrored_websites(){
  $currentDomain = 'www" + ".ilxtx." + "com';
  // $currentDomain = '"zhangge." + "net"';
  echo '<img style="display:none" src=" " onerror=\'this.onerror=null;var str1="'.$currentDomain.'";str2="docu"+"ment.loca"+"tion.host";str3=eval(str2);if( str1!=str3 && str3!="cache.baiducontent.com" && str3!="webcache.googleusercontent.com" && str3!="c.360webcache.com" && str3!="cncc.bingj.com" && str3!="snapshot.sogoucdn.com" ){ do_action = "loca" + "tion." + "href = loca" + "tion.href" + ".rep" + "lace(docu" +"ment"+".loca"+"tion.ho"+"st," + "\"' . $currentDomain .'\"" + ")";eval(do_action) }\' />';
}

/**
* 网站被恶意镜像怎么办 一段代码轻松搞定(全面版) - 龙笑天下
* https://www.ilxtx.com/mirrored-website.html
* 最后更新时间:20171022  发布时间:20160912
* 出自:zhangge.net
*/
add_action('wp_footer','lxtx_deny_mirrored_websites');
function lxtx_deny_mirrored_websites(){
  $currentDomain = 'www" + ".ilxtx." + "com';
  // $currentDomain = '"zhangge." + "net"';
  echo '<img style="display:none" src=" " onerror=\'this.onerror=null;var str1="'.$currentDomain.'";str2="docu"+"ment.loca"+"tion.host";str3=eval(str2);if( str1!=str3 && str3!="cache.baiducontent.com" && str3!="webcache.googleusercontent.com" && str3!="c.360webcache.com" && str3!="cncc.bingj.com" && str3!="snapshot.sogoucdn.com" ){ do_action = "loca" + "tion." + "href = loca" + "tion.href" + ".rep" + "lace(docu" +"ment"+".loca"+"tion.ho"+"st," + "\"' . $currentDomain .'\"" + ")";eval(do_action) }\' />';
}

Ps:如果是丢到 wp_head,经过测试发现图片放到 head,浏览器会自动进行错误调整,导致一些本来在 head 的元素被丢到了 body 当中,比如 style.css,估计网页标准中 head 里面就不应该放置图片,所以移到了 footer 当中。

/**
* 网站被恶意镜像怎么办 一段代码轻松搞定(全面版) - 龙笑天下
* https://www.ilxtx.com/mirrored-website.html
* 出自:zhangge.net
*/
add_action('wp_footer','lxtx_deny_mirrored_websites');
function lxtx_deny_mirrored_websites(){
 $currentDomain = "www' + '.ilxtx.' + 'com";
 // $currentDomain = "zhangge' + '.' + 'net";
 echo '<img style="display:none" src="nothing" onerror="this.onerror=null;var str1=\''.$currentDomain.'\';str2=\'docu\'+\'ment.loca\'+\'tion.host\';str3=eval(str2);if( str1!=str3 ){ do_action = \'loca\' + \'tion.\' + \'href = loca\' + \'tion.href\' + \'.rep\' + \'lace(docu\' +\'ment\'+\'.loca\'+\'tion.ho\'+\'st,\' + \'\\\'' . $currentDomain .'\\\'\' + \')\';eval(do_action) }" />';
}
/**
* 网站被恶意镜像怎么办 一段代码轻松搞定(全面版) - 龙笑天下
* https://www.ilxtx.com/mirrored-website.html
* zhangge.net修改
*/
add_action('wp_footer','lxtx_kimsom_reverse_proxy_defense', 99);
function lxtx_kimsom_reverse_proxy_defense(){
 $currentDomain = '"www." + "ilxtx" + ".com"';
 echo '<img style="display:none" id="inlojv-rpd" src="nothing" data-url="'.home_url().'" onerror=\'this.onerror=null;var str0=document.getElementById("inlojv-rpd").attributes.getNamedItem("data-url").nodeValue;var ishttps="https:"==document.location.protocol?true:false;if(ishttps){var str1="https"+"://";}else{var str1="http"+"://";}var str2='.$currentDomain.';var str3=str1+str2;if( str0!=str3 ){location.href = location.href.replace(document.location.host,'. $currentDomain .');}\'/>';
}

Tips:如果想像“20160909 版本”一样有个提示语,可将上面这段代码改为此

add_action('wp_footer','lxtx_kimsom_reverse_proxy_defense', 99);
function lxtx_kimsom_reverse_proxy_defense(){
 $currentDomain = '"www." + "ilxtx" + ".com"';
 echo '<img style="display:none" id="inlojv-rpd" src="nothing" data-url="'.home_url().'" onerror=\'this.onerror=null;var str0=document.getElementById("inlojv-rpd").attributes.getNamedItem("data-url").nodeValue;var ishttps="https:"==document.location.protocol?true:false;if(ishttps){var str1="https"+"://";}else{var str1="http"+"://";}var str2='.$currentDomain.';var str3=str1+str2;if( str0!=str3 ){alert("\u8b66\u544a\uff01\u68c0\u6d4b\u5230\u8be5\u7f51\u7ad9\u4e3a\u6076\u610f\u955c\u50cf\u7ad9\u70b9\uff0c\u5c06\u7acb\u5373\u4e3a\u60a8\u8df3\u8f6c\u5230\u5b98\u65b9\u7ad9\u70b9\uff01");location.href = location.href.replace(document.location.host,'. $currentDomain .');}\'/>';
}
摘自 @曾劲松博客

/**
* 网站被恶意镜像怎么办 一段代码轻松搞定(全面版) - 龙笑天下
* https://www.ilxtx.com/mirrored-website.html
*/
add_action('wp_footer','lxtx_kimsom_reverse_proxy_defense');
function lxtx_kimsom_reverse_proxy_defense(){
$domain_arr = explode('//',home_url());
$domain = $domain_arr[1];
 echo '<img style="display:none" id="inlojv-rpd" src="nothing" data-url="'.home_url().'" onerror="this.onerror=null;var str0=document.getElementById(\'inlojv-rpd\').attributes.getNamedItem(\'data-url\').nodeValue;var ishttps=\'https:\'==document.location.protocol?true:false;if(ishttps){var str1=\'https\'+\'://\';}else{var str1=\'http\'+\'://\';}var str2=\''.$domain.'\';var str3=str1+str2;if( str0!=str3 ){alert(\'\u8b66\u544a\uff01\u68c0\u6d4b\u5230\u8be5\u7f51\u7ad9\u4e3a\u6076\u610f\u955c\u50cf\u7ad9\u70b9\uff0c\u5c06\u7acb\u5373\u4e3a\u60a8\u8df3\u8f6c\u5230\u5b98\u65b9\u7ad9\u70b9\uff01\');if (!!(window.attachEvent && !window.opera)){document.execCommand(\'stop\');}else{ window.stop();}var str4=\'wind\'+\'ow.loca\'+\'tion.rep\'+\'lace(str3)\';eval(str4);}">';
}
/**
* 网站被恶意镜像怎么办 一段代码轻松搞定(全面版) - 龙笑天下
* https://www.ilxtx.com/mirrored-website.html
*/
add_action('wp_footer','lxtx_kimsom_reverse_proxy_defense');
function lxtx_kimsom_reverse_proxy_defense(){
$domain_arr = explode('//',home_url());
$domain = $domain_arr[1];
 echo '<img style="display:none" id="inlojv-rpd" src="nothing" data-url="'.home_url().'" onerror="this.onerror=null;var str0=document.getElementById(\'inlojv-rpd\').attributes.getNamedItem(\'data-url\').nodeValue;var ishttps=\'https:\'==document.location.protocol?true:false;if(ishttps){var str1=\'https\'+\'://\';}else{var str1=\'http\'+\'://\';}var str2=\''.$domain.'\';var str3=str1+str2;if( str0!=str3 ){alert(\'\u8b66\u544a\uff01\u68c0\u6d4b\u5230\u8be5\u7f51\u7ad9\u4e3a\u6076\u610f\u955c\u50cf\u7ad9\u70b9\uff0c\u5c06\u7acb\u5373\u4e3a\u60a8\u8df3\u8f6c\u5230\u5b98\u65b9\u7ad9\u70b9\uff01\');if (!!(window.attachEvent && !window.opera)){document.execCommand(\'stop\');}else{ window.stop();}var str4=\'wind\'+\'ow.loca\'+\'tion.rep\'+\'lace(str3)\';eval(str4);}">';
}

添加以上代码之后,再打开镜像站就会弹出提示:“警告!检测到该网站为恶意镜像站点,将立即为您跳转到官方站点!”,并在关闭或确定此提示后直接跳转到被镜像的网站。经过本站测试,本方法防止网站被镜像目前有效。

效果请看这里:

https://www.ilxtx.com.dijicat.com/the-shawshank-redemption-1994.html

此方法在 IE11 上,会弹出提示框,但点击“确定”按钮后,网页并不会跳转。。。Firefox、Chrome 和 360 极速浏览器上则没此问题!

②、HTML 通用版

既然是利用 js 代码,那么就能用到如何 html 页面当中了。要不是为了可以放到 wp 的 functions.php,都没必要写成 php 的模式,直接用 html 代码即可:

<img style="display:none" src=" " onerror='this.onerror=null;var currentDomain="www." + "ilxtx" + ".com"; var str1=currentDomain; str2="docu"+"ment.loca"+"tion.host"; str3=eval(str2) ;if( str1!=str3 && str3!="cache.baiducontent.com" && str3!="webcache.googleusercontent.com" && str3!="c.360webcache.com" && str3!="cncc.bingj.com" && str3!="snapshot.sogoucdn.com" ){ do_action = "loca" + "tion." + "href = loca" + "tion.href" + ".rep" + "lace(docu" +"ment"+".loca"+"tion.ho"+"st," + "currentDomain" + ")";eval(do_action) }' />

<img style="display:none" src=" " onerror='this.onerror=null;var currentDomain="www." + "ilxtx" + ".com"; var str1=currentDomain; str2="docu"+"ment.loca"+"tion.host"; str3=eval(str2) ;if( str1!=str3 && str3!="cache.baiducontent.com" && str3!="webcache.googleusercontent.com" && str3!="c.360webcache.com" && str3!="cncc.bingj.com" && str3!="snapshot.sogoucdn.com" ){ do_action = "loca" + "tion." + "href = loca" + "tion.href" + ".rep" + "lace(docu" +"ment"+".loca"+"tion.ho"+"st," + "currentDomain" + ")";eval(do_action) }' />

将以上代码中的: var currentDomain="www." + "ilxtx" + ".com"; 自行拆分成自己的域名,避免被镜像代码替换掉,比如: var currentDomain="zhangge." + "net";

然后将代码添加到网站的 <body> 之后即可(不建议放置到 <head> 里面,具体原因上文已说明),这个版本适合任何网页。

方法 5:通过禁止某些 User Agent 特征来防

服务器反爬虫攻略:Apache/Nginx/PHP 禁止某些 User Agent 抓取网站
我们都知道网络上的爬虫非常多,有对网站收录有益的,比如百度蜘蛛(Baiduspider),也有不但不遵守 robots 规则对服务器造成压力,还不能为网站带来流量的无用爬虫,比如 YY 蜘蛛(Yis...

参考上面这篇文章来禁止 UA 为 PHP 的抓取网页,从而达到防镜像的目的!

①、PHP 通用版:

将下面的代码贴到网站入口文件 index.php 中的第一个 <?php之后即可:

//防止恶意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!请正常访问,并认准【龙笑天下网】官方网址!');
  }
}

//防止恶意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!请正常访问,并认准【龙笑天下网】官方网址!');
  }
}

②、Wordpress 适用版

如果使用上面的 php 版本,WordPress 每次更新就会需要操作 index.php,比较麻烦,因此弄个专版。

将下面的代码贴到 functions.php 中的最后一个 ?>之前即可:

/**
* 网站被恶意镜像怎么办 一段代码轻松搞定(全面版) - 龙笑天下
* https://www.ilxtx.com/mirrored-website.html
* 出自:zhange.net
*/
//防止恶意HTTP_USER_AGENT采集
add_action('wp_head', 'lxtx_deny_mirrored_request', 0);
function lxtx_deny_mirrored_request()
{
$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");
wp_die('请勿采集本站,采集者木有小JJ!请正常访问,并认准【龙笑天下网】官方网址!');
}else{
  foreach($now_ua as $value )
  if(eregi($value,$ua)) {
  header("Content-type: text/html; charset=utf-8");
  wp_die('请勿采集本站,采集者木有小JJ!请正常访问,并认准【龙笑天下网】官方网址!');
  }
}
}

/**
* 网站被恶意镜像怎么办 一段代码轻松搞定(全面版) - 龙笑天下
* https://www.ilxtx.com/mirrored-website.html
* 出自:zhange.net
*/
//防止恶意HTTP_USER_AGENT采集
add_action('wp_head', 'lxtx_deny_mirrored_request', 0);
function lxtx_deny_mirrored_request()
{
$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");
wp_die('请勿采集本站,采集者木有小JJ!请正常访问,并认准【龙笑天下网】官方网址!');
}else{
  foreach($now_ua as $value )
  if(eregi($value,$ua)) {
  header("Content-type: text/html; charset=utf-8");
  wp_die('请勿采集本站,采集者木有小JJ!请正常访问,并认准【龙笑天下网】官方网址!');
  }
}
}

经过测试,在 functions.php 中加入此代码后,打开镜像站后显示“Internal Server Error”,强制刷新后显示我们设置好的提示文字“请勿采集本站,采集者木有小 JJ!请正常访问,并认准【龙笑天下网】官方网址!”。

本站目前发现的恶意镜像域名

dijicat.com
lapaleo.com
iaroex.com
disauvi.com
3s3s.org
ytlqpo.com
s3.gvirabi.com
hdtmail.com
dimyapi.com

更多镜像网站等你提供~

在这些域名前面加上你们自己的的域名,看看有没有被恶意镜像。

友情提示:建议方法 2 和方法 3 一起使用!方法 4 包含方法 2 和方法 3~

PHP 相关文章推荐
树型结构列出指定目录里所有文件的PHP类
Oct 09 PHP
用phpmyadmin更改mysql5.0登录密码
Mar 25 PHP
ThinkPHP中的create方法与自动令牌验证实例教程
Aug 22 PHP
浅析PHP中strlen和mb_strlen的区别
Aug 31 PHP
PHP图片自动裁切应付不同尺寸的显示
Oct 16 PHP
php商品对比功能代码分享
Sep 24 PHP
apache和PHP如何整合在一起
Oct 12 PHP
PHP异常处理Exception类
Dec 11 PHP
深入理解PHP中的empty和isset函数
May 26 PHP
PHP url的pathinfo模式加载不同控制器的简单实现
Aug 12 PHP
理清PHP在Linxu下执行时的文件权限方法
Jun 07 PHP
PHPUnit + Laravel单元测试常用技能
Nov 06 PHP
PHP中使用mpdf 导出PDF文件的实现方法
Oct 22 #PHP
php微信公众号开发之答题连闯三关
Oct 20 #PHP
php微信公众号开发之简答题
Oct 20 #PHP
php微信公众号开发之快递查询
Oct 20 #PHP
php微信公众号开发之翻页查询
Oct 20 #PHP
php微信公众号开发之校园图书馆
Oct 20 #PHP
php微信公众号开发之二级菜单
Oct 20 #PHP
You might like
ThinkPHP的cookie和session冲突造成Cookie不能使用的解决方法
2014/07/01 PHP
Zend Framework路由器用法实例详解
2016/12/11 PHP
Javascript的IE和Firefox兼容性汇编
2006/07/01 Javascript
超级兔子让浮动层消失的前因后果
2007/03/09 Javascript
js类后台管理菜单类-MenuSwitch
2007/09/12 Javascript
javascript 必知必会之closure
2009/09/21 Javascript
js中将URL中的参数提取出来作为对象的实现代码
2011/08/16 Javascript
禁用键盘上的(全局)指定键兼容iE、Chrome、火狐
2013/05/14 Javascript
实现只能输入数字的input不用replace方法
2013/09/12 Javascript
js鼠标点击图片实现随机变换图片的方法
2015/02/16 Javascript
jquery SweetAlert插件实现响应式提示框
2015/08/18 Javascript
JavaScript判断FileUpload控件上传文件类型
2015/09/28 Javascript
JavaScript实现解析INI文件内容的方法
2016/11/17 Javascript
JavaScript数据结构之二叉查找树的定义与表示方法
2017/04/12 Javascript
JavaScript实现全选取消效果
2017/12/14 Javascript
Vuex 使用及简单实例(计数器)
2018/08/29 Javascript
浅谈关于JS下大批量异步任务按顺序执行解决方案一点思考
2019/01/08 Javascript
微信小程序学习笔记之本地数据缓存功能详解
2019/03/29 Javascript
Kettle中使用JavaScrip调用jar包对文件内容进行MD5加密的操作方法
2020/09/04 Javascript
Python中Collection的使用小技巧
2014/08/18 Python
python中的__slots__使用示例
2015/02/26 Python
Android模拟器无法启动,报错:Cannot set up guest memory ‘android_arm’ Invalid argument的解决方法
2016/07/01 Python
彻底理解Python list切片原理
2017/10/27 Python
Python程序运行原理图文解析
2018/02/10 Python
python使用mysql的两种使用方式
2018/03/07 Python
基于numpy中数组元素的切片复制方法
2018/11/15 Python
Pyqt5如何让QMessageBox按钮显示中文示例代码
2019/04/11 Python
python实现的config文件读写功能示例
2019/09/24 Python
使用python写一个自动浏览文章的脚本实例
2019/12/05 Python
Python random模块的使用示例
2020/10/10 Python
LUISAVIAROMA德国官网:时尚奢侈品牌购物网站
2020/11/12 全球购物
个人简历的自荐信
2013/10/23 职场文书
财务总经理岗位职责
2014/02/16 职场文书
保证书格式
2015/01/16 职场文书
党委工作总结2015
2015/04/27 职场文书
解读MySQL的客户端和服务端协议
2021/05/10 MySQL