天亦网2年前发布关注私信 ordPress外链转内链对一个网站的seo很有帮助,文章中过多的外链会降低你的网站权重,如果你非常在意的话,可以通过插件国人开发的插件anylink,来实现,我其实一直也不在意这个事情,当我们发现权重流失时,可以试试下面的方法,免去插件的麻烦。当然代码对于首页的友情链接,文章页内自己的文章的链接是不会起作用的。 1、在functions.php添加以下代码 /*自动给文章的外部链接添加nofollow属性*/ add_filter('the_content','web589_the_content_nofollow',999); function web589_the_content_nofollow($content){ preg_match_all('/href="(http.*?)"/',$content,$matches); if($matches){ foreach($matches[1] as $val){ if( strpos($val,home_url())===false ) $content=str_replace("href=\"$val\"", "rel=\"nofollow\" href=\"" . get_bloginfo('wpurl'). "/go?url=" .base64_encode($val). "\"",$content); } } return $content; } 2.在网站根目录下建立go文件夹(注意是网站的根目录,不是主题的根目录。建立index.php文件,复制以下代码) <?php $url = $_GET['url']; $a = ''; if( $a==$url ) { $b = "https://www.vqxel.com/"; // echo 'true'; } else { $b = $url; $b = base64_decode($b); } //Template Name:链接跳转(有过度) ?> <html> <head> <meta charset=utf-8 /> <meta name="robots" content="nofollow"> <meta http-equiv="refresh" content="0.1;url=<?php echo $b; ?>"> <title>正在为您跳转……</title> <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:41.5%;left:47%;margin:16px 0 0 35px;color:#BBB;letter-spacing:1px;font-weight:700;font-size:9px;font-family:Arial}.spinner{position:absolute;top:40%;left:45%;display:block;margin:0;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> 把 $b = "https://www.vqxel.com/";换成你的网址。以上技术来自网络,已经测试没有问题–). 以上代码增加了跳转美化效果,代码中已经用 base64 将源链接加密,并且加上了 nofollow,但恐怕蜘蛛还是能爬行,在 Robot s 禁止所有蜘蛛爬行 /go?url 目录! Disallow: /go/ Disallow: /go?url 温馨提示:本文最后更新于2023-06-16 23:55:44,某些文章具有时效性,若有错误或已失效,请私信客服或联系知新社长。 © 版权声明文章版权归作者所有,未经允许请勿转载。 六月 16 知岛上的今时往日 2024:王国保卫战:复仇/Kingdom Rush Vengeance - Tower Defense (0)2024:古代武器荷莉/Ancient Weapon Holly (0)2024:胡闹修车/Manic Mechanics (0)2024:刃裔学院/Blade Prince Academy (0)2024:夺魂/Taken Soul (0) THE END网站/配置/代码# WordPress# 友情链接# 权重# anylink 喜欢就支持一下吧点赞0赞赏 分享QQ空间微博QQ好友海报分享复制链接收藏
ordPress外链转内链对一个网站的seo很有帮助,文章中过多的外链会降低你的网站权重,如果你非常在意的话,可以通过插件国人开发的插件anylink,来实现,我其实一直也不在意这个事情,当我们发现权重流失时,可以试试下面的方法,免去插件的麻烦。当然代码对于首页的友情链接,文章页内自己的文章的链接是不会起作用的。 1、在functions.php添加以下代码 /*自动给文章的外部链接添加nofollow属性*/ add_filter('the_content','web589_the_content_nofollow',999); function web589_the_content_nofollow($content){ preg_match_all('/href="(http.*?)"/',$content,$matches); if($matches){ foreach($matches[1] as $val){ if( strpos($val,home_url())===false ) $content=str_replace("href=\"$val\"", "rel=\"nofollow\" href=\"" . get_bloginfo('wpurl'). "/go?url=" .base64_encode($val). "\"",$content); } } return $content; } 2.在网站根目录下建立go文件夹(注意是网站的根目录,不是主题的根目录。建立index.php文件,复制以下代码) <?php $url = $_GET['url']; $a = ''; if( $a==$url ) { $b = "https://www.vqxel.com/"; // echo 'true'; } else { $b = $url; $b = base64_decode($b); } //Template Name:链接跳转(有过度) ?> <html> <head> <meta charset=utf-8 /> <meta name="robots" content="nofollow"> <meta http-equiv="refresh" content="0.1;url=<?php echo $b; ?>"> <title>正在为您跳转……</title> <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:41.5%;left:47%;margin:16px 0 0 35px;color:#BBB;letter-spacing:1px;font-weight:700;font-size:9px;font-family:Arial}.spinner{position:absolute;top:40%;left:45%;display:block;margin:0;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> 把 $b = "https://www.vqxel.com/";换成你的网址。以上技术来自网络,已经测试没有问题–). 以上代码增加了跳转美化效果,代码中已经用 base64 将源链接加密,并且加上了 nofollow,但恐怕蜘蛛还是能爬行,在 Robot s 禁止所有蜘蛛爬行 /go?url 目录! Disallow: /go/ Disallow: /go?url