VPS侦探论坛

 找回密码
 注册
查看: 3498|回复: 1

为做seo这样写跳转到https会不会好点?

[复制链接]
发表于 2016-5-7 14:09:13 | 显示全部楼层 |阅读模式

百度虽然说能抓取https但是网站做了两个月.也提交了还是不能收录.360可以搜录https.下面规则判定百度360等蜘蛛抓取的时候不跳转https 还有就是做了https以后xp系统会无法访问这个规则也解决了xp的问题    直接上规则
      #若请求协议是http,则继续将变量增量赋值es
        if ($scheme = 'http' ) {
            set $ssl "${ssl}es";
        }
        #若变量值为yes,即命中上述2个条件,则跳转到https
        if ( $ssl = "yes" ) {
            rewrite ^(.*)$ https://$host$1 permanent;
        }
        # ==================== 以下为新增内容 =======================
        #若UA匹配到不支持https的请求,则设置变量为n:
        if ($http_user_agent ~* "Windows\ NT\ 5.1|Windows\ NT\ 5.2|BaiduSpider|360Spider|YisouSpider|Sosospider|sogou spider") {
            set $ssl "n";
        }
        if ($scheme = 'https' ) {
           set $ssl "${ssl}o";
        }
        #若变量值为no,即命中上述2个条件,则跳转到http
        if ( $ssl = "no" ) {
            rewrite ^(.*)$ http://$host$1 permanent;
        }
如果有大神有更好的办法.把规则共享出来
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2016-5-7 18:29:33 | 显示全部楼层


蜘蛛的口味没法说
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-29 07:20 , Processed in 0.034589 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表