首页 >  帮助中心 > emlog外链本地化

emlog外链本地化

来源:原创 点击量(43) 发布时间:2019-10-13

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

新建一个php文件并命名为go.php放到网站根目录,go.php中写入以下代码:

<?php
$post = trim($post);
$post = strip_tags($post,""); //清除HTML等代码
$post = ereg_replace("\t","",$post); //去掉制表符号
$post = ereg_replace("\r\n","",$post); //去掉回车换行符号
$post = ereg_replace("\r","",$post); //去掉回车
$post = ereg_replace("\n","",$post); //去掉换行
$post = ereg_replace(" ","",$post); //去掉空格
$post = ereg_replace("'","",$post); //去掉单引号
$go=$_REQUEST["url"];
function if_http($http_url){
	$url=$http_url;
	$preg='|^http://|';
	if(!preg_match($preg,$url)){
		$url='http://'.$url;
	}
	$tz_url=$url;
	return $tz_url;
}
$web=if_http($go);
header("Location:$web");
?>

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

使用方法,以默认模板为例:

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

在你需要的链接上面添加域名/go.php?url=外链

  • 服务热线   4006-598-598