WordPress 教程:WordPress 防镜像代码记录
代码如下:(复制粘贴到主题的 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) }\' />';
- }
评论