Typecho评论链接重定向、加密

Typecho评论链接重定向、加密

第一步:打开var/Widget/Abstract/Comments.php文件,将

if ($this->url && $autoLink) {
            echo '<a href="' , $this->url , '"' , ($noFollow ? ' rel="external nofollow"' : NULL) , '>' , $this->author , '</a>';
        } else {
            echo $this->author;
        }


替换为:

if ($this->url && $autoLink) { 
if(strpos($this-&gt;url, $this-&gt;options-&gt;siteUrl)!==false) { 
                echo '<a href="', $this-&gt;url, '">', $this-&gt;author, '</a>'; 
            } else { 
                echo '<a href="', $this-&gt;options-&gt;siteUrl, 'redirect.html?url=', base64_encode($this-&gt;url), '" ',="" '="" rel="nofollow">', $this-&gt;author, '</a>'; 
            } 
        } else { 
            echo $this-&gt;author; 
        }

第二步:将redirect.zip解压,把其中的base64.js和redirect.html上传到博客根目录。
点击下载:http://aikvn.com/usr/uploads/2012/04/172007328.zip
redirect.zip

实现方法:其实非常简单,利用PHP自带的Base64加密函数和通用JS揭秘函数,将URL地址加密输出,再通过redirect.html解密并跳转。由于使用了Javascript跳转,而搜索引擎是不识别Javascript的,因此对于搜索引擎来说,这个页面没有任何意义。从根本上杜绝了垃圾链接对博客的影响。

转自:AiKvn

相关文章

发表新评论