{"id":1279,"date":"2012-01-17T13:40:19","date_gmt":"2012-01-17T05:40:19","guid":{"rendered":"http:\/\/doophp.sinaapp.com\/?p=1279"},"modified":"2012-01-17T14:03:35","modified_gmt":"2012-01-17T06:03:35","slug":"robots-introduction","status":"publish","type":"post","link":"https:\/\/blog.vimge.com\/archives\/other\/robots-introduction.html","title":{"rendered":"\u9650\u5236\u641c\u7d22\u5f15\u64ce\u722c\u866b\u6293\u53d6\u7f51\u7ad9\u5185\u5bb9"},"content":{"rendered":"

\u641c\u7d22\u5f15\u64ce\u722c\u866b\u7ecf\u5e38\u6293\u53d6\u6536\u5f55\u7f51\u7ad9\u5728\u901a\u5e38\u60c5\u51b5\u4e0b\u5e94\u8be5\u662f\u6709\u5229\u4e8e\u7f51\u7ad9\u5bf9\u5916\u63a8\u5e7f\u4f20\u64ad\u7684\uff0c\u4f46\u5f88\u9057\u61be\uff0c\u4e00\u4e9b\u6280\u672f\u6bd4\u8f83\u201c\u70c2\u201d\u7684\u641c\u7d22\u722c\u866b\u6211\u4eec\u751a\u81f3\u53ef\u4ee5\u8ba4\u4e3a\u5b83\u4eec\u66f4\u50cf\u6d41\u6c13\u3001\u65e0\u8d56.\u6bd4\u5982\uff0c\u67d0\u4e9b\u722c\u866b\u672c\u8eab\u6280\u672f\u5c31\u5b58\u5728\u7f3a\u9677\uff0c\u7ed3\u679c\u5bfc\u81f4\u4e00\u6b21\u6293\u53d6\u5c0f\u7f51\u7ad9\u7684\u65f6\u5019\u80fd\u628a\u6574\u4e2a\u7f51\u7ad9\u7ed9\u62d6\u57ae(\u4e0d\u8981\u544a\u8bc9\u6211\u8fd9\u6837\u7684\u4e8b\u60c5\u6ca1\u6709\u53d1\u751f\u8fc7)\uff0c\u53e6\u5916\u8fd8\u6709\u50cf\u91c7\u7528\u4e91\u670d\u52a1\u6258\u7ba1\u7684\u7f51\u7ad9\uff0c\u6bd4\u5982SAE\uff0c\u6d41\u91cf\u548c\u8ba1\u7b97\u91cf\u90fd\u662f\u8981\u6536\u8d39\u7684\u3002\u5c3c\u739b\u4e00\u4e2a\u672c\u6765\u5c31\u6ca1\u6709\u591a\u5c11\u6d41\u91cf\u7684\u641c\u7d22\u5f15\u64ce\uff0c\u5929\u5929\u8fc7\u6765\u6293\u5185\u5bb9\uff0c\u5e26\u6765\u5c11\u7684\u53ef\u601c\u7684\u6d41\u91cf\u8ddf\u82b1\u53bb\u7684\u6d41\u91cf\u8d39\u7528\u5bf9\u6bd4\uff0c\u7b80\u76f4\u8ba9\u4eba\u5fc3\u61c2\uff0c\u9274\u4e8e\u6b64\u7c7b\u539f\u56e0\uff0c\u672c\u4eba\u505a\u51fa\u4e00\u4e2a\u8270\u96be\u7684\u51b3\u5b9a\uff0c\u5c01\u6740\u67d0\u4e9b\u641c\u7d22\u5f15\u64ce\u3002<\/p>\n

\u9996\u5148\u6211\u4eec\u5927\u6982\u4e86\u89e3\u4e00\u4e0b\u201crobots.txt\u201d\u6587\u4ef6<\/p>\n

\u4ec0\u4e48\u662frobots.txt\u6587\u4ef6?<\/strong><\/p>\n

\u641c\u7d22\u5f15\u64ce\u4f7f\u7528spider\u7a0b\u5e8f\u81ea\u52a8\u8bbf\u95ee\u4e92\u8054\u7f51\u4e0a\u7684\u7f51\u9875\u5e76\u83b7\u53d6\u7f51\u9875\u4fe1\u606f\u3002spider\u5728\u8bbf\u95ee\u4e00\u4e2a\u7f51\u7ad9\u65f6\uff0c\u4f1a\u9996\u5148\u4f1a\u68c0\u67e5\u8be5\u7f51\u7ad9\u7684\u6839\u57df\u4e0b<\/em>\u662f\u5426\u6709\u4e00\u4e2a\u53eb\u505a robots.txt\u7684\u7eaf\u6587\u672c\u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u7528\u4e8e\u6307\u5b9aspider\u5728\u60a8\u7f51\u7ad9\u4e0a\u7684\u6293\u53d6\u8303\u56f4\u3002\u60a8\u53ef\u4ee5\u5728\u60a8\u7684\u7f51\u7ad9\u4e2d\u521b\u5efa\u4e00\u4e2arobots.txt\uff0c\u5728\u6587\u4ef6\u4e2d\u58f0\u660e \u8be5\u7f51\u7ad9\u4e2d\u4e0d\u60f3\u88ab\u641c\u7d22\u5f15\u64ce\u6536\u5f55\u7684\u90e8\u5206\u6216\u8005\u6307\u5b9a\u641c\u7d22\u5f15\u64ce\u53ea\u6536\u5f55\u7279\u5b9a\u7684\u90e8\u5206\u3002<\/p>\n

robots.txt\u6587\u4ef6\u7684\u683c\u5f0f<\/strong>
\n“robots.txt”\u6587\u4ef6\u5305\u542b\u4e00\u6761\u6216\u66f4\u591a\u7684\u8bb0\u5f55\uff0c\u8fd9\u4e9b\u8bb0\u5f55\u901a\u8fc7\u7a7a\u884c\u5206\u5f00\uff08\u4ee5CR,CR\/NL, or NL\u4f5c\u4e3a\u7ed3\u675f\u7b26\uff09\uff0c\u6bcf\u4e00\u6761\u8bb0\u5f55\u7684\u683c\u5f0f\u5982\u4e0b\u6240\u793a\uff1a
\n“<field>:<optionalspace><value><optionalspace>”\u3002<\/p>\n

\u5728\u8be5\u6587\u4ef6\u4e2d\u53ef\u4ee5\u4f7f\u7528#\u8fdb\u884c\u6ce8\u89e3\uff0c\u5177\u4f53\u4f7f\u7528\u65b9\u6cd5\u548cUNIX\u4e2d\u7684\u60ef\u4f8b\u4e00\u6837\u3002\u8be5\u6587\u4ef6\u4e2d\u7684\u8bb0\u5f55\u901a\u5e38\u4ee5\u4e00\u884c\u6216\u591a\u884cUser-agent\u5f00\u59cb\uff0c\u540e\u9762\u52a0\u4e0a\u82e5\u5e72Disallow\u548cAllow\u884c,\u8be6\u7ec6\u60c5\u51b5\u5982\u4e0b\uff1a<\/p>\n

User-agent:
\n\u8be5\u9879\u7684\u503c\u7528\u4e8e\u63cf\u8ff0\u641c\u7d22\u5f15\u64cerobot\u7684\u540d\u5b57\u3002\u5728”robots.txt”\u6587\u4ef6\u4e2d\uff0c\u5982\u679c\u6709\u591a\u6761User-agent\u8bb0\u5f55\u8bf4\u660e\u6709\u591a\u4e2arobot\u4f1a\u53d7 \u5230”robots.txt”\u7684\u9650\u5236\uff0c\u5bf9\u8be5\u6587\u4ef6\u6765\u8bf4\uff0c\u81f3\u5c11\u8981\u6709\u4e00\u6761User-agent\u8bb0\u5f55\u3002\u5982\u679c\u8be5\u9879\u7684\u503c\u8bbe\u4e3a*\uff0c\u5219\u5bf9\u4efb\u4f55robot\u5747\u6709\u6548\uff0c \u5728”robots.txt”\u6587\u4ef6\u4e2d\uff0c”User-agent:*”\u8fd9\u6837\u7684\u8bb0\u5f55\u53ea\u80fd\u6709\u4e00\u6761\u3002\u5982\u679c\u5728”robots.txt”\u6587\u4ef6\u4e2d\uff0c\u52a0\u5165”User- agent:SomeBot”\u548c\u82e5\u5e72Disallow\u3001Allow\u884c\uff0c\u90a3\u4e48\u540d\u4e3a”SomeBot”\u53ea\u53d7\u5230”User-agent:SomeBot”\u540e\u9762\u7684 Disallow\u548cAllow\u884c\u7684\u9650\u5236\u3002<\/p>\n

Disallow:
\n\u8be5\u9879\u7684\u503c\u7528\u4e8e\u63cf\u8ff0\u4e0d\u5e0c\u671b\u88ab\u8bbf\u95ee\u7684\u4e00\u7ec4URL\uff0c\u8fd9\u4e2a\u503c\u53ef\u4ee5\u662f\u4e00\u6761\u5b8c\u6574\u7684\u8def\u5f84\uff0c\u4e5f\u53ef\u4ee5\u662f\u8def\u5f84\u7684\u975e\u7a7a\u524d\u7f00\uff0c\u4ee5Disallow\u9879\u7684\u503c\u5f00\u5934\u7684URL\u4e0d\u4f1a\u88ab robot\u8bbf\u95ee\u3002\u4f8b\u5982”Disallow:\/help”\u7981\u6b62robot\u8bbf\u95ee\/help.html\u3001\/helpabc.html\u3001\/help \/index.html\uff0c\u800c”Disallow:\/help\/”\u5219\u5141\u8bb8robot\u8bbf\u95ee\/help.html\u3001\/helpabc.html\uff0c\u4e0d\u80fd\u8bbf\u95ee \/help\/index.html\u3002“Disallow:”\u8bf4\u660e\u5141\u8bb8robot\u8bbf\u95ee\u8be5\u7f51\u7ad9\u7684\u6240\u6709url\uff0c\u5728”\/robots.txt”\u6587\u4ef6\u4e2d\uff0c\u81f3\u5c11\u8981\u6709\u4e00 \u6761Disallow\u8bb0\u5f55\u3002<\/span>\u5982\u679c”\/robots.txt”\u4e0d\u5b58\u5728\u6216\u8005\u4e3a\u7a7a\u6587\u4ef6\uff0c\u5219\u5bf9\u4e8e\u6240\u6709\u7684\u641c\u7d22\u5f15\u64cerobot\uff0c\u8be5\u7f51\u7ad9\u90fd\u662f\u5f00\u653e\u7684\u3002<\/p>\n

Allow:
\n\u8be5\u9879\u7684\u503c\u7528\u4e8e\u63cf\u8ff0\u5e0c\u671b\u88ab\u8bbf\u95ee\u7684\u4e00\u7ec4URL\uff0c\u4e0eDisallow\u9879\u76f8\u4f3c\uff0c\u8fd9\u4e2a\u503c\u53ef\u4ee5\u662f\u4e00\u6761\u5b8c\u6574\u7684\u8def\u5f84\uff0c\u4e5f\u53ef\u4ee5\u662f\u8def\u5f84\u7684\u524d\u7f00\uff0c\u4ee5Allow\u9879\u7684\u503c\u5f00\u5934\u7684URL \u662f\u5141\u8bb8robot\u8bbf\u95ee\u7684\u3002\u4f8b\u5982”Allow:\/hibaidu”\u5141\u8bb8robot\u8bbf\u95ee\/hibaidu.htm\u3001\/hibaiducom.html\u3001 \/hibaidu\/com.html\u3002\u4e00\u4e2a\u7f51\u7ad9\u7684\u6240\u6709URL\u9ed8\u8ba4\u662fAllow\u7684\uff0c\u6240\u4ee5Allow\u901a\u5e38\u4e0eDisallow\u642d\u914d\u4f7f\u7528\uff0c\u5b9e\u73b0\u5141\u8bb8\u8bbf\u95ee\u4e00\u90e8\u5206\u7f51\u9875 \u540c\u65f6\u7981\u6b62\u8bbf\u95ee\u5176\u5b83\u6240\u6709URL\u7684\u529f\u80fd\u3002<\/p>\n

\u9700\u8981\u7279\u522b\u6ce8\u610f\u7684\u662fDisallow\u4e0eAllow\u884c\u7684\u987a\u5e8f\u662f\u6709\u610f\u4e49\u7684\uff0crobot\u4f1a\u6839\u636e\u7b2c\u4e00\u4e2a\u5339\u914d\u6210\u529f\u7684Allow\u6216Disallow\u884c\u786e\u5b9a\u662f\u5426\u8bbf\u95ee\u67d0\u4e2aURL\u3002<\/p>\n

\u4f7f\u7528”*”\u548c”$”\uff1a
\nBaiduspider\u652f\u6301\u4f7f\u7528\u901a\u914d\u7b26”*”\u548c”$”\u6765\u6a21\u7cca\u5339\u914durl\u3002<\/p>\n

“$” \u5339\u914d\u884c\u7ed3\u675f\u7b26\u3002
\n“*” \u5339\u914d0\u6216\u591a\u4e2a\u4efb\u610f\u5b57\u7b26\u3002<\/p>\n

\u7981\u6b62\u6307\u5b9a\u641c\u7d22\u5f15\u64ce\u722c\u866b<\/strong><\/p>\n

User-agent: Baiduspider<\/p>\n

Disallow: \/<\/p><\/blockquote>\n

\u53ea\u5141\u8bb8\u6307\u5b9a\u641c\u7d22\u5f15\u64ce\u722c\u866b<\/strong><\/p>\n

User-agent: Baiduspider<\/p>\n

Disallow:<\/p>\n

User-agent: Googlebot<\/p>\n

Disallow:<\/p>\n

User-agent: *<\/p>\n

Disallow: \/<\/p><\/blockquote>\n

\u5411\u641c\u7d22\u5f15\u64ce\u63d0\u4ea4Site Map<\/strong><\/p>\n

\n
Sitemap: http:\/\/www.google.com\/sitemap.xml<\/pre>\n<\/blockquote>\n

robots.txt\u6587\u4ef6\u7528\u6cd5\u4e3e\u4f8b\uff1a<\/strong><\/p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u4f8b1.<\/strong> \u7981\u6b62\u6240\u6709\u641c\u7d22\u5f15\u64ce\u8bbf\u95ee\u7f51\u7ad9\u7684\u4efb\u4f55\u90e8\u5206<\/strong><\/td>\nUser-agent: *
\nDisallow: \/<\/em><\/td>\n<\/tr>\n
\u4f8b2.<\/strong> \u5141\u8bb8\u6240\u6709\u7684robot\u8bbf\u95ee<\/strong>
\n(\u6216\u8005\u4e5f\u53ef\u4ee5\u5efa\u4e00\u4e2a\u7a7a\u6587\u4ef6\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 “\/robots.txt”)<\/td>\n
User-agent: *
\nDisallow:\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/em>
\n\u6216\u8005
\nUser-agent: *
\nAllow: \/ <\/em><\/td>\n<\/tr>\n
\u4f8b3. \u4ec5\u7981\u6b62Baiduspider\u8bbf\u95ee\u60a8\u7684\u7f51\u7ad9<\/strong><\/td>\nUser-agent: Baiduspider
\nDisallow: \/<\/em><\/td>\n<\/tr>\n
\u4f8b4. \u4ec5\u5141\u8bb8Baiduspider\u8bbf\u95ee\u60a8\u7684\u7f51\u7ad9<\/strong><\/td>\nUser-agent: Baiduspider
\nDisallow:<\/em>User-agent: *
\nDisallow: \/<\/em><\/td>\n<\/tr>\n
\u4f8b5. \u7981\u6b62spider\u8bbf\u95ee\u7279\u5b9a\u76ee\u5f55<\/strong>
\n\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u8be5\u7f51\u7ad9\u6709\u4e09\u4e2a\u76ee\u5f55\u5bf9\u641c\u7d22\u5f15\u64ce\u7684\u8bbf\u95ee\u505a\u4e86\u9650\u5236\uff0c\u5373robot\u4e0d\u4f1a\u8bbf\u95ee\u8fd9\u4e09\u4e2a\u76ee\u5f55\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\u5bf9\u6bcf\u4e00\u4e2a\u76ee\u5f55\u5fc5\u987b\u5206\u5f00\u58f0\u660e\uff0c\u800c\u4e0d\u80fd\u5199\u6210\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 “Disallow: \/cgi-bin\/ \/tmp\/”\u3002<\/td>\n
User-agent: *
\nDisallow: \/cgi-bin\/
\nDisallow:\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/tmp\/
\nDisallow: \/~joe\/<\/em><\/td>\n<\/tr>\n
\u4f8b6. \u5141\u8bb8\u8bbf\u95ee\u7279\u5b9a\u76ee\u5f55\u4e2d\u7684\u90e8\u5206url<\/strong><\/td>\nUser-agent: *
\nAllow: \/cgi-bin\/see
\nAllow:\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/tmp\/hi
\nAllow: \/~joe\/look
\nDisallow:\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/cgi-bin\/
\nDisallow: \/tmp\/
\nDisallow: \/~joe\/<\/em><\/td>\n<\/tr>\n
\u4f8b7. \u4f7f\u7528”*”\u9650\u5236\u8bbf\u95eeurl<\/strong>
\n\u7981\u6b62\u8bbf\u95ee\/cgi-bin\/\u76ee\u5f55\u4e0b\u7684\u6240\u6709\u4ee5”.htm”\u4e3a\u540e\u7f00\u7684URL(\u5305\u542b\u5b50\u76ee\u5f55)\u3002<\/td>\n
User-agent: *
\nDisallow:\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/cgi-bin\/*.htm
\n<\/em><\/td>\n<\/tr>\n
\u4f8b8. \u4f7f\u7528”$”\u9650\u5236\u8bbf\u95eeurl<\/strong>
\n\u4ec5\u5141\u8bb8\u8bbf\u95ee\u4ee5”.htm”\u4e3a\u540e\u7f00\u7684URL\u3002<\/td>\n
User-agent: *
\nAllow: .htm$
\nDisallow:\u00a0\/<\/em><\/td>\n<\/tr>\n
\u4f8b9. \u7981\u6b62\u8bbf\u95ee\u7f51\u7ad9\u4e2d\u6240\u6709\u7684\u52a8\u6001\u9875\u9762<\/strong><\/td>\nUser-agent: *
\nDisallow: \/*?*<\/em><\/td>\n<\/tr>\n
\u4f8b10. \u7981\u6b62Baiduspider\u6293\u53d6\u7f51\u7ad9\u4e0a\u6240\u6709\u56fe\u7247<\/strong>
\n\u4ec5\u5141\u8bb8\u6293\u53d6\u7f51\u9875\uff0c\u7981\u6b62\u6293\u53d6\u4efb\u4f55\u56fe\u7247\u3002<\/td>\n
User-agent: Baiduspider
\nDisallow: \/*.jpg$
\nDisallow: \/*.jpeg$
\nDisallow: \/*.gif$
\nDisallow: \/*.png$
\nDisallow: \/*.bmp$<\/em><\/td>\n<\/tr>\n
\u4f8b11. \u4ec5\u5141\u8bb8Baiduspider\u6293\u53d6\u7f51\u9875\u548c.gif\u683c\u5f0f\u56fe\u7247<\/strong>
\n\u5141\u8bb8\u6293\u53d6\u7f51\u9875\u548cgif\u683c\u5f0f\u56fe\u7247\uff0c\u4e0d\u5141\u8bb8\u6293\u53d6\u5176\u4ed6\u683c\u5f0f\u56fe\u7247<\/td>\n
User-agent: Baiduspider
\nAllow: \/*.gif$
\nDisallow: \/*.jpg$
\nDisallow: \/*.jpeg$
\nDisallow: \/*.png$
\nDisallow: \/*.bmp$<\/em><\/td>\n<\/tr>\n
\u4f8b12. \u4ec5\u7981\u6b62Baiduspider\u6293\u53d6.jpg\u683c\u5f0f\u56fe\u7247<\/strong><\/td>\nUser-agent: Baiduspider
\nDisallow:\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\/*.jpg$<\/em><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u5e38\u89c1\u56fd\u5185\u641c\u7d22\u5f15\u64ce\u8718\u86db\u7a0b\u5e8f\u540d\u79f0 (User-agent List)<\/strong><\/p>\n