zoukankan      html  css  js  c++  java
  • 在不影响seo的情况下!网站跳转【搜索引擎跳转】

    你可以写在伪静态里,网址自己替换,判断是搜索引擎点击的,一律301跳转
    这是Nginx的:

    location / {
            if ($http_user_agent ~* baiduspider|googlebot|soso|bing|sogou|yahoo|sohu-search|yodao|robozilla|msnbot)
            {
                    rewrite /.* https://www.mixiujie.cn;
            }
    }
    

      这是Apache的:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} (baiduspider|googlebot|soso|bing|sogou|yahoo|sohu-search|yodao|robozilla|msnbot) [NC]
    RewriteRule .* https://www.mixiujie.cn
    </IfModule>
    

      

    你可以写在伪静态里,网址自己替换,判断是搜索引擎点击的,一律301跳转
    这是Nginx的:

    location / {
    if ($http_user_agent ~* baiduspider|googlebot|soso|bing|sogou|yahoo|sohu-search|yodao|robozilla|msnbot|等等搜索引擎可自行添加)
    {
    rewrite /.* https://www.你的网站.com;
    }
    }

    百度js代码:
    var regexp=/.(baidu)(.[a-z0-9-]+){1,2}//ig;
    var where =document.referrer;
    if(regexp.test(where))
    {
    window.location.href="百度bai来的访客 带到你要给访问的地址,例如https ://qq .co m"
    }
    把代码存到JS文件 然后网站首页dao调用这个JS文件 就OK了
    复制代码
    var regexp=/.(baidu|biso可以自行添加谷歌 搜狗 好搜 神马搜索)(.[a-z0-9-]+){1,2}//ig;
    var where =document.referrer;
    if(regexp.test(where))
    {
    window.location.href='https ://qq .co m '
    }
    拿去吧 不用谢,放入底部模板 生成静态 动态都可以 蜘蛛抓取正常,从百度进来访问的跳转,自己可以加谷歌 搜狗 好搜 神马搜索
    替换自己的网址链接就行

  • 相关阅读:
    pip升级报错AttributeError: 'NoneType' object has no attribute 'bytes'
    在Windows中安装MySQL
    nginx配置成功,浏览器无法访问
    mysql 安装完以后没有mysql服务
    对字符串的切片操作
    linux下anaconda的安装和使用
    python学习笔记
    python学习笔记2018-9-18
    python学习笔记2018-9-17
    电脑必须用U盘引导盘才能进系统解决办法
  • 原文地址:https://www.cnblogs.com/djjv/p/13808950.html
Copyright © 2011-2022 走看看