抱歉,您的浏览器无法访问本站
本页面需要浏览器支持(启用)JavaScript
了解详情 >

Emlog外链本地化(外链重定向跳转)

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

go.php中写入以下代码

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

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

Disallow: /go.php?url=*

使用方法

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

1 评论

既然来了就吐个槽吧

撰写评论~

单词 kh4xz最后字符是什么?
  1. Avatar
    雨中独行 网友

    你现在用的这个怎么弄呢?

Music Icon🎵 未加载歌曲
00:00
00:00
暂无歌词
Power by 疯狂老司机