外链本地化(外链重定向跳转)
新建一个php文件并命名为go.php放到网站根目录,

go.php中写入以下代码

 
  1. <?php  
  2. $post = trim($post);  
  3. $post = strip_tags($post,""); //清除HTML等代码  
  4. $post = ereg_replace("\t","",$post); //去掉制表符号  
  5. $post = ereg_replace("\r\n","",$post); //去掉回车换行符号  
  6. $post = ereg_replace("\r","",$post); //去掉回车  
  7. $post = ereg_replace("\n","",$post); //去掉换行  
  8. $post = ereg_replace(" ","",$post); //去掉空格  
  9. $post = ereg_replace("'","",$post); //去掉单引号  
  10. $go=$_REQUEST["url"];  
  11. function if_http($http_url){  
  12.     $url=$http_url;  
  13.     $preg='|^http://|';  
  14.     if(!preg_match($preg,$url)){  
  15.         $url='http://'.$url;  
  16.     }  
  17.     $tz_url=$url;  
  18.     return $tz_url;  
  19. }  
  20. $web=if_http($go);  
  21. header("Location:$web");  
  22. ?>  

可以在根目录中打开robot.txt添加以下代码,
从而拒绝重定向的外部链接被搜索引擎索引到:

Disallow: /go.php?url=*

使用方法

module.php中'.$comment['url'].'改为'.BLOG_URL.'go.php?url='.$comment['url'].'