{"id":1042,"date":"2020-01-31T17:42:52","date_gmt":"2020-01-31T08:42:52","guid":{"rendered":"https:\/\/www.dogrow.net\/hp\/?p=1042"},"modified":"2021-11-12T13:24:51","modified_gmt":"2021-11-12T04:24:51","slug":"blog78","status":"publish","type":"post","link":"https:\/\/www.dogrow.net\/hp\/blog78\/","title":{"rendered":"(78) BOT\u306e\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3059\u308b\u3002"},"content":{"rendered":"<h1 class=\"my_h\">1. \u3084\u308a\u305f\u3044\u3053\u3068<\/h1>\n<p>\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u30fc\u306bWEB\u30b5\u30a4\u30c8\u3092\u8a2d\u7f6e\u3057\u3066\u3044\u308b\u3002<\/p>\n<p>\u305f\u307e\u305f\u307e <span class=\"my_fc_deeppinkBBig\">\u30a2\u30af\u30bb\u30b9\u7d71\u8a08\u753b\u9762<\/span> \u3092\u898b\u3066\u307f\u305f\u3089\u3001\u7d50\u69cb\u306a\u30a2\u30af\u30bb\u30b9\u6570\u304c\u3042\u308b\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/hp\/wp-content\/uploads\/2020\/01\/001.png\" alt=\"\" class=\"my_add_bs1\" \/><\/p>\n<p><span class=\"my_fc_crimsonBBig\">1\u65e5\u306b 17\u4e07\u56de\u3082\u30ea\u30af\u30a8\u30b9\u30c8\uff1f\uff01<\/span><\/p>\n<p><span class=\"my_fc_crimsonB\">\u305d\u3093\u306a\u306f\u305a\u304c\u306a\u3044\u3002<br \/>\n\u4f55\u304b\u304c\u304a\u304b\u3057\u3044&#8230;<\/span><\/p>\n<p>\u3068\u601d\u3044&#8230;<br \/>\n\u30a2\u30af\u30bb\u30b9\u89e3\u6790\u30ed\u30b0\u3092\u53c2\u7167\u3057\u3066\u307f\u305f\u3002<\/p>\n<p>\u3059\u308b\u3068&#8230;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/hp\/wp-content\/uploads\/2020\/01\/002.png\" alt=\"\" class=\"my_add_bs1\" \/><\/p>\n<p>\u30ed\u30b0\u304b\u3089\u78ba\u8a8d\u3067\u304d\u305f\u3060\u3051\u3067 <span class=\"my_fc_crimsonB\">BOT\u304b\u3089\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u304c 1\u65e5\u306b 1\u4e07\u56de\u4ee5\u4e0a<\/span> \u3082\u3042\u308b\u3002<br \/>\n\u304a\u305d\u3089\u304f\u3053\u306e\u30ed\u30b0\u3067\u6f0f\u308c\u3066\u3044\u308b BOT\u304c\u4ed6\u306b\u3082\u305f\u304f\u3055\u3093\u3042\u308b\u306f\u305a\u3002<\/p>\n<p>\u3067\u3001\u4eca\u56de\u306f&#8230;<br \/>\n<span class=\"my_fc_deeppinkBBig\">WEB\u30b5\u30a4\u30c8\u306e\u8ca0\u8377\u3092\u8efd\u6e1b\u3059\u308b\u305f\u3081<br \/>\nGoogle\u4ee5\u5916\u306e BOT\u306b\u3088\u308b WEB\u30b5\u30a4\u30c8\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\uff08\u9664\u5916\u3001\u906e\u65ad\uff09\u3057\u305f\u3044\u3002<\/span><\/p>\n<p>\u3053\u308c\u3092\u5b9f\u73fe\u3059\u308b\u624b\u6bb5\u3092\u30c4\u30e9\u30c4\u30e9\u3068\u8a18\u9332\u3057\u3066\u304a\u304f\u3002<\/p>\n<h1 class=\"my_h\">2. \u3084\u3063\u3066\u307f\u308b<\/h1>\n<h2 class=\"my_h\">\u5bfe\u7b561\uff1aApache\u306e .htaccess\u3067BOT\u3092\u9664\u5916\u3059\u308b\u3002<\/h2>\n<p>\u4ee5\u4e0b\u306e <span class=\"my_fc_deeppinkB\">.htaccess<\/span> \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057 WEB\u30b5\u30a4\u30c8\u306e\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u7f6e\u3044\u3066\u304a\u304f\u3002<br \/>\nHTTP\u30d7\u30ed\u30c8\u30b3\u30eb\u306e\u30c7\u30fc\u30bf\u306b\u542b\u307e\u308c\u308b\u30d6\u30e9\u30a6\u30b6\u60c5\u5831 User-Agent \u306b\u7279\u5b9a\u306e BOT\u540d\u304c\u542b\u307e\u308c\u3066\u3044\u308c\u3070\u30a2\u30af\u30bb\u30b9\u62d2\u5426\u3067\u304d\u308b\u3002<\/p>\n<p><a href=\"https:\/\/httpd.apache.org\/docs\/trunk\/ja\/mod\/mod_setenvif.html#browsermatchnocase\" target=\"_blank\" rel=\"noopener\">BrowserMatchNoCase<\/a> : HTTP User-Agent \u306b\u57fa\u3065\u3044\u3066\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u305b\u305a\u306b \u74b0\u5883\u5909\u6570\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n<p>\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u305f\u3044\u5834\u5408\u306f\u3001BrowserMatch\u3092\u4f7f\u7528\u3059\u308b\u3002<br \/>\n<a href=\"https:\/\/httpd.apache.org\/docs\/trunk\/ja\/mod\/mod_setenvif.html#BrowserMatch\" target=\"_blank\" rel=\"noopener\">BrowserMatch<\/a> : HTTP User-Agent \u306b\u57fa\u3065\u3044\u3066\u74b0\u5883\u5909\u6570\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nBrowserMatchNoCase bingbot IsBOT    # \u30d6\u30e9\u30a6\u30b6\u60c5\u5831\u306b bingbot \u304c\u542b\u307e\u308c\u3066\u3044\u308b\u306a\u3089\u3070\u3001\u74b0\u5883\u5909\u6570 IsBOT \u3092\u30bb\u30c3\u30c8\r\nBrowserMatchNoCase SemrushBot IsBOT # \u30d6\u30e9\u30a6\u30b6\u60c5\u5831\u306b SemrushBot \u304c\u542b\u307e\u308c\u3066\u3044\u308b\u306a\u3089\u3070\u3001\u74b0\u5883\u5909\u6570 IsBOT \u3092\u30bb\u30c3\u30c8\r\nBrowserMatchNoCase ccbot IsBOT      # \u30d6\u30e9\u30a6\u30b6\u60c5\u5831\u306b ccbot \u304c\u542b\u307e\u308c\u3066\u3044\u308b\u306a\u3089\u3070\u3001\u74b0\u5883\u5909\u6570 IsBOT \u3092\u30bb\u30c3\u30c8\r\nBrowserMatchNoCase Twitterbot IsBOT # \u30d6\u30e9\u30a6\u30b6\u60c5\u5831\u306b Twitterbot \u304c\u542b\u307e\u308c\u3066\u3044\u308b\u306a\u3089\u3070\u3001\u74b0\u5883\u5909\u6570 IsBOT \u3092\u30bb\u30c3\u30c8\r\nBrowserMatchNoCase Applebot IsBOT   # \u30d6\u30e9\u30a6\u30b6\u60c5\u5831\u306b Applebot \u304c\u542b\u307e\u308c\u3066\u3044\u308b\u306a\u3089\u3070\u3001\u74b0\u5883\u5909\u6570 IsBOT \u3092\u30bb\u30c3\u30c8\r\n\r\norder Allow,Deny      # \u8a31\u53ef\u3001\u7981\u6b62\u306e\u9806\u306b\u8a18\u8ff0\u3059\u308b\u3002\r\nAllow from all        # \u3059\u3079\u3066\u8a31\u53ef\u3059\u308b\u3002\r\nDeny from env=IsBOT   # \u3067\u3082\u3001\u74b0\u5883\u5909\u6570 IsBOT\u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u306a\u3089\u3070\u62d2\u5426\u3059\u308b\u3002\r\n<\/pre>\n<p><span class=\"my_fc_deeppinkB\">BrowserMatchNoCase<\/span> \u306e\u4ee3\u308f\u308a\u306b <span class=\"my_fc_deeppinkB\">SetEnvIf User-Agent<\/span> \u3068\u66f8\u3044\u3066\u3082\u3088\u3044\u3002<\/p>\n<p><a href=\"https:\/\/httpd.apache.org\/docs\/trunk\/ja\/mod\/mod_setenvif.html#SetEnvIf\" target=\"_blank\" rel=\"noopener\">SetEnvIf<\/a> : \u30ea\u30af\u30a8\u30b9\u30c8\u306e\u5c5e\u6027\u306b\u57fa\u3065\u3044\u3066\u74b0\u5883\u5909\u6570\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nSetEnvIf User-Agent bingbot IsBOT # \u30d6\u30e9\u30a6\u30b6\u60c5\u5831\u306b bingbot \u304c\u542b\u307e\u308c\u3066\u3044\u308b\u306a\u3089\u3070\u3001\u74b0\u5883\u5909\u6570 IsBOT \u3092\u30bb\u30c3\u30c8\r\n\u3000:\r\n<\/pre>\n<p><span class=\"my_fc_crimsonB\">\u203b\u81ea\u5206\u3067\u6b63\u76f4\u306b\u540d\u524d\u3092\u540d\u4e57\u3063\u3066\u304f\u308c\u308b\u6b63\u7d71\u6d3eBOT\u306b\u3057\u304b\u52b9\u304b\u306a\u3044\u5bfe\u7b56\u3067\u306f\u3042\u308b&#8230;<\/span><\/p>\n<h2 class=\"my_h\">\u5bfe\u7b562\uff1aPHP\u30d7\u30ed\u30b0\u30e9\u30e0\u3067 BOT\u3092\u9664\u5916\u3059\u308b\u3002<\/h2>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a BOT\u5224\u5b9a\u95a2\u6570\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nfunction is_BOT(){\r\n  $isBot = TRUE;\r\n  $agent = $_SERVER&#x5B;'HTTP_USER_AGENT'];\r\n  $ary_bot = array('bingbot','ccbot','SemrushBot','Twitterbot','Applebot');\r\n  foreach($ary_bot as $bot){\r\n    if(preg_match(&quot;\/{$bot}\/i&quot;,$agent) === 1){   \/\/ \u30de\u30c3\u30c1\u3057\u305f\u306a\u3089\u3070 1\u3092\u8fd4\u3059\r\n      goto tagEND;     \/\/ BOT\u3067\u3042\u308b\u3068\u5224\u65ad\r\n    }\r\n  }\r\n  $isBot = FALSE;\r\ntagEND:\r\n  return $isBot;\r\n}\r\n<\/pre>\n<p>\u547c\u3073\u51fa\u3057\u5074\u3067\u306f TRUE\u5224\u5b9a\u304c\u8fd4\u3055\u308c\u305f\u3089 exit()\u3057\u3066 HTML\u30b3\u30fc\u30c9\u3092\u51fa\u529b\u3057\u306a\u3051\u308c\u3070\u3088\u3044\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nif(TRUE === IsBOT()){\r\n  exit();\r\n}\r\n<\/pre>\n<h1 class=\"my_h\">3. \u3069\u306e\u5bfe\u7b56\u304c\u3088\u3044\u306e\u304b\uff1f<\/h1>\n<p>\u307e\u305a\u3001PHP\u3067\u51fa\u529b\u3055\u308c\u308b WEB\u30da\u30fc\u30b8\u3092\u958b\u304f\u5834\u5408\u306e\u6d41\u308c\u3092\u7c21\u5358\u306b\u66f8\u304f\u3068\u3001\u4ee5\u4e0b\u306e\u901a\u308a\u3002<br \/>\n1) WEB\u30d6\u30e9\u30a6\u30b6 : URL\u3092\u6307\u5b9a\u3057\u3066 HTTP\u30ea\u30af\u30a8\u30b9\u30c8\u3092 WEB\u30b5\u30fc\u30d0\u30fc\u3078\u9001\u308b\u3002<br \/>\n2) WEB\u30b5\u30fc\u30d0\u30fc : PHP\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3057\u3066 HTML\u3092\u751f\u6210\u3057\u3001WEB\u30d6\u30e9\u30a6\u30b6\u3078\u8fd4\u5374\u3059\u308b\u3002<br \/>\n3) WEB\u30d6\u30e9\u30a6\u30b6 : HTML\u6587\u306b\u66f8\u304b\u308c\u305f\u753b\u50cf\u3084 CSS, JavaScript\u306a\u3069\u306e\u30d5\u30a1\u30a4\u30eb\u53d6\u5f97\u306e\u305f\u3081\u306b HTTP\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u7e70\u308a\u8fd4\u3057\u767a\u884c\u3059\u308b\u3002<\/p>\n<h3 class=\"my_h\">\u5bfe\u7b561\u3092\u63a1\u7528\u3059\u308b\u3068\uff1f<\/h3>\n<p><span class=\"my_fc_blueBBig\">\u3007 \u30e1\u30ea\u30c3\u30c8<\/span><br \/>\n\u30fb\u4f55\u3088\u308a\u3082\u5b9f\u88c5\u304c\u697d\u3060\u3002<br \/>\n\u30fb\u4e0a\u8a182)\u306e PHP\u5b9f\u884c\u524d\u306e\u65e9\u3044\u6bb5\u968e\u3067\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3067\u304d\u308b\u3002\uff08PHP\u3092\u5b9f\u884c\u3055\u305b\u306a\u3044\u3002\uff09<\/p>\n<p><span class=\"my_fc_crimsonBBig\">\u00d7 \u30c7\u30e1\u30ea\u30c3\u30c8<\/span><br \/>\n\u30fb\u30a2\u30af\u30bb\u30b9\u3092\u62d2\u5426\u3057\u306a\u3044\u6b63\u5e38\u7cfb\u51e6\u7406\u3067\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u4f4e\u4e0b\u306e\u61f8\u5ff5\u3042\u308a\u3002<br \/>\n\u3000PHP\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u51fa\u529b\u3059\u308b HTML\u6587\u306b\u753b\u50cf\u304c\u6570\u767e\u679a\u3042\u308b\u306a\u3069\u3001HTTP\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u591a\u6570\u767a\u884c\u3059\u308bHTML\u30b3\u30fc\u30c9\u306e\u5834\u5408\u3001.htaccess\u4e0a\u306e\u7167\u5408\u51e6\u7406\u304cHTTP\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u6570\u3060\u3051\u767a\u751f\u3059\u308b\u305f\u3081\u3001WEB\u30b5\u30fc\u30d0\u30fc\u5074\u306e\u51e6\u7406\u8ca0\u8377\u304c\u4e0a\u304c\u308b\u3002\u300c\u5875\u3082\u7a4d\u3082\u308c\u3070\u2026\u300d\u3067\u30a2\u30af\u30bb\u30b9\u6570\u306e\u591a\u3044\u30b5\u30a4\u30c8\u307b\u3069\u5f71\u97ff\u304c\u5927\u304d\u3044\u3002<\/p>\n<h3 class=\"my_h\">\u5bfe\u7b562\u3092\u63a1\u7528\u3059\u308b\u3068\uff1f<\/h3>\n<p>\u4e0a\u8ff0\u306e\u5bfe\u7b561\u306e\u88cf\u8fd4\u3057\u306b\u306a\u308b\u3002<\/p>\n<h3 class=\"my_h\">\u3069\u3046\u3059\u308b\u304b\uff1f<\/h3>\n<p>\u3088\u3063\u3066&#8230;<br \/>\n<span class=\"my_fc_deeppinkBBig\">\u57fa\u672c\u7684\u306b\u306f\u3001\u5bfe\u7b561\u3092\u63a1\u7528\u3059\u308b\u3002<br \/>\n\u753b\u50cf\u591a\u6570\u306a\u3069\u3001\u901a\u5e38\u306e\u95b2\u89a7\u3067 HTTP\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u591a\u767a\u3059\u308b\u3088\u3046\u306a WEB\u30b5\u30a4\u30c8\u306e\u5834\u5408\u3001\u5bfe\u7b562\u3092\u63a1\u7528\u3059\u308b\u3002<\/span><\/p>\n<p>\u306b\u3057\u3088\u3046\u3068\u601d\u3046\u3002<\/p>\n<h1 class=\"my_h\">4. \u53c2\u8003\u60c5\u5831<\/h1>\n<p><a href=\"https:\/\/httpd.apache.org\/docs\/trunk\/ja\/mod\/mod_setenvif.html\" target=\"_blank\" rel=\"noopener\">Apache \u30e2\u30b8\u30e5\u30fc\u30eb mod_setenvif<\/a><\/p>\n<hr class=\"my_hr_bottom\">\n","protected":false},"excerpt":{"rendered":"<p>1. \u3084\u308a\u305f\u3044\u3053\u3068 \u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u30fc\u306bWEB\u30b5\u30a4\u30c8\u3092\u8a2d\u7f6e\u3057\u3066\u3044\u308b\u3002 \u305f\u307e\u305f\u307e \u30a2\u30af\u30bb\u30b9\u7d71\u8a08\u753b\u9762 \u3092\u898b\u3066\u307f\u305f\u3089\u3001\u7d50\u69cb\u306a\u30a2\u30af\u30bb\u30b9\u6570\u304c\u3042\u308b\u3002 1\u65e5\u306b 17\u4e07\u56de\u3082\u30ea\u30af\u30a8\u30b9\u30c8\uff1f\uff01 \u305d\u3093\u306a\u306f\u305a\u304c\u306a\u3044\u3002 \u4f55\u304b\u304c\u304a\u304b\u3057\u3044&#8230; \u2026 <span class=\"read-more\"><a href=\"https:\/\/www.dogrow.net\/hp\/blog78\/\">\u7d9a\u304d\u3092\u8aad\u3080 &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"class_list":["post-1042","post","type-post","status-publish","format-standard","hentry","category-bot"],"views":3611,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/posts\/1042","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/comments?post=1042"}],"version-history":[{"count":57,"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/posts\/1042\/revisions"}],"predecessor-version":[{"id":1734,"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/posts\/1042\/revisions\/1734"}],"wp:attachment":[{"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/media?parent=1042"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/categories?post=1042"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dogrow.net\/hp\/wp-json\/wp\/v2\/tags?post=1042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}