电脑端效果
手机端效果
文章源自小虫博客-https://www.xczi.cn/wordpress/401.html
新建一个go.php文件,放置到网站的根目录下,在go.php里面输入:文章源自小虫博客-https://www.xczi.cn/wordpress/401.html
找到模板的functions.php文件添加:文章源自小虫博客-https://www.xczi.cn/wordpress/401.html
//评论者链接添加go跳转
function add_redirect_comment_link($text = ''){
$text=str_replace('href="', 'href="'.get_option('home').'/go.php/?url=', $text);
return $text;
}
add_filter('get_comment_author_link', 'add_redirect_comment_link', 5);
add_filter('comment_text', 'add_redirect_comment_link', 99);
//文章内外链添加go跳转
function the_content_nofollow($content){
preg_match_all('/<a(.*?)href="(.*?)"(.*?)>/',$content,$matches);
if($matches){
foreach($matches[2] as $val){
if(strpos($val,'://')!==false && strpos($val,home_url())===false && !preg_match('/\.(jpg|jepg|png|ico|bmp|gif|tiff)/i',$val)){
$content=str_replace("href=\"$val\"", "href=\"".home_url()."/go.php/?url=$val\" ",$content);
}
}
}
return $content;
}
add_filter('the_content','the_content_nofollow',999);
以上代码增加了跳转美化效果,代码中已经用 base64 将源链接加密,并且加上了 nofollow,但恐怕蜘蛛还是能爬行,在 Robot 禁止所有蜘蛛爬行 /go?url 目录!文章源自小虫博客-https://www.xczi.cn/wordpress/401.html
Disallow: /go/
Disallow: /go?url
文章源自小虫博客-https://www.xczi.cn/wordpress/401.html 文章源自小虫博客-https://www.xczi.cn/wordpress/401.html
评论