首页 网站源码内容详情

SEO不输出权重的跳转方法

2022-01-01 345 admin

注重SEO优化的站长朋友都知道,过多的外链会影响网站权重,而且影响极大。那么有没有一种不输出权重的站内跳转方式呢?很多站长通过go.php的方式跳转,这个方法是不错的,但是必须要用对、用精,而且URL美观性也是另一个问题,下面0735导航网站长给大家详细讲解下。


一、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;?>";
}
setTimeout(jump, 10000);
setTimeout(function(){window.opener=null;window.close();}, 10000);
</script>

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

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

在robots.txt文件中再加一句:

Disallow: /go/

四、最终完整的go.php代码:

<?php
$url = preg_replace('/^url=(.*)$/i','$1',$_SERVER["QUERY_STRING"]);
if(!empty($url)) {
    preg_match('/(http|https):\/\//',$url,$matches);
    if($matches){
        $url=$url;
        $title='页面加载中,请稍候...';
    } else {
        preg_match('/\./i',$url,$matche);
        if($matche){
            $url='http://'.$url;
            $title='页面加载中,请稍候...';
        } else {
            $url='https://0735dj.com/';
            $title='参数错误,正在返回首页...';
        }
    }
} else {
    $title='参数缺失,正在返回首页...';
    $url='https://0735dj.com/';
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="imotao-com" />
<noscript><meta http–equiv="refresh" content="1;url='<?php echo $url;?>';"></noscript>
<script>
function jump()
{
    location.href="<?php echo $url;?>";
}
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="0735dj.com" />
<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>
    <span class="spinner"></span>
  </div>
</div>
</body>
</html>


相关标签: # SEO跳转 # 权重跳转方法

 暂无评论,快来抢沙发吧~

发布评论