• nginx 和apache 过滤蜘蛛跳转


    apache

    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} !^.*Baiduspider [NC]
    RewriteCond %{HTTP_HOST} ^cms.c.com [NC]
    RewriteRule ^(.*)$ http://www.baidu.com [R=301,L]
    

     nginx

    server {
            listen       80;
            server_name  cms.c.com;
            
            set $flag 0;
            if ($http_user_agent ~* "Baiduspider|googlebot|bing|sogou|yahoo"){
                    set $flag "1";
            }
    
            if ($flag != "1") { 
                    rewrite ^/(.*)$ http://www.baidu.com permanent; 
            }               
            
            root   "E:/php-Project/cms.c.com";
            location / {
                index  index.html index.htm index.php;
                #autoindex  on;
            }
            location ~ .php(.*)$ {
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_split_path_info  ^((?U).+.php)(/?.+)$;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                fastcgi_param  PATH_INFO  $fastcgi_path_info;
                fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
                include        fastcgi_params;
            }
    }
    

      

  • 相关阅读:
    Java绘出pdf实现方法
    Java设置字体颜色
    猜测分箱算法
    获取图片存储到本地
    input(file)异步上传文件
    物流轨迹抓取
    bootstrap 模态框
    从数组中随机选择一个数
    spring cron表达式
    mabtis批量修改
  • 原文地址:https://www.cnblogs.com/saonian/p/10837317.html
Copyright © 2020-2023  润新知