SEO不输出权重的跳转方法/站内跳转go.php优化版

SEO不输出权重的跳转方法/站内跳转go.php优化版

低调G
2020-04-29 / 2 评论 / 1,038 阅读 / 正在检测是否收录...

注重SEO的站长都了解,过多的外链会影响网站权重,而且影响极大。那么有没有一种不输出权重的站内跳转方式呢?很多站长通过go.php的方式跳转,这个方法是不错的,但是必须要用对、用精,而且URL美观性也是另一个问题,下面给各位站长从头到尾讲解一下。

SEO禁止抓取优化

首先来分析,由于百度也会抓取php页面,通过go.php直接跳转,并不能保证效果。所以需要在跳转页面加上一句:

<meta name="robots" content="noindex, nofollow" />

同时,在robots.txt也加上一句:

Disallow: /go.php

这样,百度就不会抓取这个专门用来跳转的页面了。

跳转时间优化

跳转的时间既不能太长也不能太短,一秒钟刚刚好。同时也要设置10秒钟后自动关闭跳转页面,比如下载文件时,文件下载完成时,这个页面并不会自动关闭,这里通过JS实现,代码如下:

<script>
function jump()
{
    location.href="<?php echo $url;?>";
}
//from www.ddg.ink
setTimeout(jump, 10000);
setTimeout(function(){window.opener=null;window.close();}, 10000);
</script>

URL美观性优化

ddg.ink/go.php?url=baidu.com,这么长的参数,简直逼死强迫症。那么,我们可以使用nginx的伪静态来美化一下,这样就挺不错:ddg.ink/go/baidu.com,通过下方的nginx伪静态规则来实现(注意如果go.php不在根目录,需将目录换成自己):

rewrite ^/go/(.*)$ /go.php?url=$1 last;

如此,甚好!但是聪明的我们也要想到,在robots.txt文件中再加一句:

Disallow: /go/

防止别人盗用我们的go.php

...自己发挥吧

最终完整的go.php代码:

<?php
$url = preg_replace('/^url=(.*)$/i','$1',$_SERVER["QUERY_STRING"]);
if(!empty($url)) {
    preg_match('/(http|https):\/\//',$url,$matches);
    //from www.ddg.ink
    if($matches){
        $url=$url;
        $title='页面加载中,请稍候...';
    } else {
        preg_match('/\./i',$url,$matche);
        if($matche){
            $url='http://'.$url;
            $title='页面加载中,请稍候...';
        } else {
            $url='http://www.ddg.ink/';
            $title='参数错误,正在返回首页...';
        }
    }
} else {
    $title='参数缺失,正在返回首页...';
    $url='http://www.ddg.ink/';
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="kxxzz-com" />
<noscript><meta http–equiv="refresh" content="1;url='<?php echo $url;?>';"></noscript>
<script>
function jump()
{
    location.href="<?php echo $url;?>";
}
//from www.ddg.ink
setTimeout(jump, 1000);
setTimeout(function(){window.opener=null;window.close();}, 10000);
</script>
<title><?php echo $title;?></title>
<meta name="robots" content="noindex, nofollow" />
<meta name="author" content="ddg.ink" />
<style>body{background:#000}.loading{-webkit-animation:fadein 2s;-moz-animation:fadein 2s;-o-animation:fadein 2s;animation:fadein 2s}@-moz-keyframes fadein{from{opacity:0}to{opacity:1}}@-webkit-keyframes fadein{from{opacity:0}to{opacity:1}}@-o-keyframes fadein{from{opacity:0}to{opacity:1}}@keyframes fadein{from{opacity:0}to{opacity:1}}.spinner-wrapper{position:absolute;top:0;left:0;z-index:300;height:100%;min-width:100%;min-height:100%;background:rgba(255,255,255,0.93)}.spinner-text{position:absolute;top:50%;left:50%;margin-left:-90px;margin-top: 2px;color:#BBB;letter-spacing:1px;font-weight:700;font-size:36px;font-family:Arial}.spinner{position:absolute;top:50%;left:50%;display:block;margin-left:-160px;width:1px;height:1px;border:25px solid rgba(100,100,100,0.2);-webkit-border-radius:50px;-moz-border-radius:50px;border-radius:50px;border-left-color:transparent;border-right-color:transparent;-webkit-animation:spin 1.5s infinite;-moz-animation:spin 1.5s infinite;animation:spin 1.5s infinite}@-webkit-keyframes spin{0%,100%{-webkit-transform:rotate(0deg) scale(1)}50%{-webkit-transform:rotate(720deg) scale(0.6)}}@-moz-keyframes spin{0%,100%{-moz-transform:rotate(0deg) scale(1)}50%{-moz-transform:rotate(720deg) scale(0.6)}}@-o-keyframes spin{0%,100%{-o-transform:rotate(0deg) scale(1)}50%{-o-transform:rotate(720deg) scale(0.6)}}@keyframes spin{0%,100%{transform:rotate(0deg) scale(1)}50%{transform:rotate(720deg) scale(0.6)}}</style>
</head>
<body>
<div class="loading">
  <div class="spinner-wrapper">
    <span class="spinner-text">页面加载中,请稍候...</span>
    <!-- from www.ddg.ink -->
    <span class="spinner"></span>
  </div>
</div>
</body>
</html>
0

评论 (2)

取消
  1. 头像
    TuAn
    Windows 7 · Google Chrome

    这个要咋食用?

    回复
    1. 头像
      低调哥 作者
      Android Pie · UC Browser
      @ TuAn

      这个是插件

      回复