防止网站被镜像
⒈添加到 header.php 中适当位置
注:部分镜像站点会屏蔽 JS 代码,所以对部分镜像站点无效
1 | <script type="text/javascript">if (document.location.protocol != "https:" && navigator.userAgent.indexOf("MSIE 6.0") < 0 ) { location.href = location.href.replace(/^http:/,"https:");}if (document.location.host != "1han.wiki") { location.href = location.href.replace(document.location.host,'1han.wiki');} </script> |
⒉添加到主题的 functions.php 最后一个?> 之前
1 | add_action('wp_head','kimsom_reverse_proxy_defense', 99); |
记得修改成自己域名