标签 跳转 下的文章

SeaCMS静态模式跳转页码功能

版本:V13.2
静态模式: 目录2:/{dir}/{page}id

编辑/js/function.js文件第171行,找到

goUrl=(url.split('_').length<3)?regexpSplice(url,/(\/\/\S+\d+?)(\.html|\.htm|\.shtml|\.shtm|\.asp|\.php)/,str):regexpSplice(url,/(\/\/\S+\d+?)_\d+(\.html|\.htm|\.shtml|\.shtm|\.asp)/,str);

修改为

goUrl=(url.split('_').length<2)?regexpSplice(url,/(\/\/\S+\d+?)(\.html|\.htm|\.shtml|\.shtm|\.asp|\.php)/,str):regexpSplice(url,/(\/\/\S+\d+?)_\d+(\.html|\.htm|\.shtml|\.shtm|\.asp)/,str);

- 阅读剩余部分 -

PHP判断搜索引擎蜘蛛来路进行301跳转

<?php
if (preg_match("#(Baiduspider|Googlebot|Sogou spider|Sogou web spider|Sogou wap spider|YodaoBot|YandexBot|bingbot|Yahoo! Slurp|MSNBot|Bytespider|YisouSpider|360Spider|Yahoo)#si", $_SERVER['HTTP_USER_AGENT'])) {
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: https://www.2dan.cc/");
    exit;
}
?>

用户访问网站完全正常,搜索引擎蜘蛛 User Agent 就301跳转。这个不得不说很隐蔽,被搞了不容易发现。

JavaScript判断搜索引擎蜘蛛来路自动跳转

今天在逛搜外论坛时,看到一坛友的提问贴,问题是:

在Google搜索关键词,点击索引进入相关网站后,自动跳转到另一个网站了,而直接通过域名访问该网站就不会跳转。这是如何做到的呢?

经过查看该站源代码,发现引用了一段JS代码:

var s = document.referrer;
if (s.indexOf("google") > 0 || s.indexOf("baidu") > 0 || s.indexOf("bing") > 0 || s.indexOf("yandex") > 0 || s.indexOf("yahoo") > 0 || s.indexOf("sm") > 0 || s.indexOf("sogou") > 0 || s.indexOf("toutiao") > 0 || s.indexOf("douyin") > 0 || s.indexOf("ixigua") > 0 || s.indexOf("aol") > 0 || s.indexOf("ask") > 0) {
        window.location.href = 'http://www.2dan.cc/'
}

到这里,聪明的你肯定知道答案了 ^_^