远端WEB服务器上存在/robots.txt文件

解决方案:

1. 可直接删除(可参考:http://zh.wikipedia.org/wiki/Robots.txt) ,但不利于SEO等

2. 修改Web服务器配置

可以通过Web服务器(如Apache,Nginx)进行配置,禁止对.txt后缀文件的访问,此时会产生403错误,需要配置一下。

2.1 Apache配置:

<FilesMatch "\.(txt|xml|)">
     Order deny,allow
    Deny from all
</FilesMatch>

 指定403.html文件的配置信息

ErrorDocument 403 /403.html 

2.2 Nginx配置:

修改nginx.conf文件,

# vim /usr/local/nginx/conf/nginx.conf

location ~* \.(txt|doc)$ {
  root /usr/local/nginx/html;
  deny all;
}

指定403.html文件的配置信息

error_page 403 /403.html;
  location = /403.html {
   root html;
}

配置后均需要重载,或重启服务。

 

posted @ 2016-05-09 20:18  寻找普拉多  阅读(2278)  评论(0编辑  收藏  举报