防止Google将“ deny_all”编入索引=错误403

时间:2019-01-24 08:24:37

标签: nginx indexing

例如,我有一个我不希望Google索引的目录(已被索引),该目录为example.com/img

然后在我的Ngnix配置中使用:

"Error": [
    {
     "type": "Application",
     "timeStamp": "2019-01-24T02:05:47.767-06:00",
     "SystemSpecificResults": [
        {
           "Message": [
             {
               "code": "ERR.SP.PROVIDER_ERROR",
               "content": "Unable to perform air booking step"
              }
           ]
        }
      ]

这将返回没有标题的403错误。

我读到有关添加标题的信息,例如:

location ~ /\.(?!well-known).* {
    deny all;
}

但是我发现它们没有附加到403错误。

那么,如何防止google将其编入索引?

P.S。我已经有机器人拒绝该目录,但是Google搜索控制台说必须使用noindex对其进行修复。

1 个答案:

答案 0 :(得分:0)

听起来您不想返回403,而是想修改响应以使该X-Robots-Tag标头的值为noindex或无(根据Block search indexing with 'noindex'):

location ~ /\.(?!well-known).* {
    add_header "X-Robots-Tag" "none";
}
  1. 删除deny指令
  2. 添加add_header指令

Read more @ Module ngx_http_headers_module