注重seo的站长都了解,过多的外链会影响网站权重,而且影响极大。那么有没有一种不输出权重的站内跳转方式呢?很多站长通过go.php的方式跳转,这个方法是不错的,但是必须要用对、用精,而且URL美观性也是另一个问题,下面给各位站长从头到尾讲解一下。
一、SEO禁止抓取优化
首先来分析,由于百度也会抓取php页面,通过go.php直接跳转,并不能保证效果。所以需要在跳转页面加上一句:
1 | <meta name="robots" content="noindex, nofollow" /> |
同时,在robots.txt也加上一句:
1 | Disallow: /go.php |
这样,百度就不会抓取这个专门用来跳转的页面了。
二、跳转时间优化跳转的时间既不能太长也不能太短,一秒钟刚刚好。同时也要设置10秒钟后自动关闭跳转页面,比如下载文件时,文件下载完成时,这个页面并不会自动关闭,这里通过JS实现,代码如下:
1 2 3 4 5 6 7 8 | <script>function jump(){ location.href="";}//from www.imotao.comsetTimeout(jump, 10000);setTimeout(function(){window.opener=null;window.close();}, 10000);cript> |
三、URL美观性优化
imotao.com/go.php?url=baidu.com,这么长的参数,简直逼死强迫症。那么,我们可以使用nginx的伪静态来美化一下,这样就挺不错:imotao.com/go/baidu.com,通过下方的nginx伪静态规则来实现(注意如果go.php不在根目录,需将目录换成自己):
1 | rewrite ^/go/(.*)$ /go.php?url=$1 last; |
如此,甚好!但是聪明的我们也要想到,在robots.txt文件中再加一句:
1 | Disallow: /go/ |
四、防止别人盗用我们的go.php...自己发挥吧
五、最终完整的go.php代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | <?php$url = preg_replace('/^url=(.*)$/i','$1',$_SERVER["QUERY_STRING"]);if(!empty($url)) { preg_match('/(http|https):\/\//',$url,$matches); //from http://www.dzlsseo.com/ if($matches){ $url=$url; $title='页面加载中,请稍候...'; } else { preg_match('/\./i',$url,$matche); if($matche){ $url='http://'.$url; $title='页面加载中,请稍候...'; } else { $url='http://www.dzlsseo.com/'; $title='参数错误,正在返回首页...'; } }} else { $title='参数缺失,正在返回首页...'; $url='http://www.dzlsseo.com/';}?><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='';">cript><script>function jump(){ location.href="";}//from www.imotao.comsetTimeout(jump, 1000);setTimeout(function(){window.opener=null;window.close();}, 10000);cript><meta name="robots" content="noindex, nofollow" /><meta name="author" content="imotao.com" />rames 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)}}" _ue_custom_node_="true"> 页面加载中,请稍候... |
如此一来,我们拥有了还算完美的SEO不输出权重的站内跳转方法。


上一篇
