{"id":277,"date":"2003-08-31T10:10:35-04:00","date_gmt":"2003-08-31T18:10:35+00:00","guid":{"rendered":"http:\/\/peterjanes.ca\/wordpress\/?p=277"},"modified":"2003-08-31T10:10:35-04:00","modified_gmt":"2003-08-31T18:10:35+00:00","slug":"subtleties-of-robotstxt","status":"publish","type":"post","link":"https:\/\/peterjanes.ca\/blog\/2003\/08\/31\/subtleties-of-robotstxt\/","title":{"rendered":"Subtleties of&nbsp;robots.txt"},"content":{"rendered":"<div class='e-content'><p>I recently discovered a subtlety of the <samp>\/robots.txt<\/samp> file.  (For those who don&#8217;t know, <samp>\/robots.txt<\/samp> is a <cite class=\"term\">configuration file<\/cite> for web spiders that tells them what URLs not to retrieve from a website.)  The issue is this: parsers will not <cite class=\"term\">fall back<\/cite> to a more general <samp>User-Agent<\/samp> setting if they&#8217;ve already matched a specific one.  This is actually spelled out in <a href=\"http:\/\/www.robotstxt.org\/wc\/norobots.html\"><cite class=\"title\">A Standard for Robot Exclusion<\/cite><\/a> &#8212; <q>If the [<samp>User-Agent<\/samp>] value is &#8216;*&#8217;, the record describes the default access policy for any robot that <em>has not matched any of the other records<\/em><\/q> &#8212; but I&#8217;d forgotten it when I updated my <samp>\/robots.txt<\/samp> recently to exclude certain additional URIs (removed from my site due to abuse) that <a href=\"http:\/\/www.google.com\/\">Google<\/a> seems to have such a fondness for that it won&#8217;t drop them from its index.<\/p>\n\n<p>Here&#8217;s an excerpt from <samp>\/robots.txt<\/samp> that shows the error:<\/p>\n\n<pre><code>User-agent: Googlebot\nDisallow: \/CBP\/\n\nUser-agent: *\nDisallow: \/cgi-bin\/\nDisallow: \/personal\/<\/code><\/pre>\n\n<p>Imagine my surprise when Googlebot started spidering <samp>\/cgi-bin\/show?user=Webmaster<\/samp>, my address-obfuscating contact form, and pages under <samp>\/personal\/<\/samp> which <cite class=\"term\">poison<\/cite> the lists of e-mail addresses and URIs that <cite class=\"term\">address harvesters<\/cite> collect.<\/p>\n\n<p>I&#8217;ve updated <samp>\/robots.txt<\/samp> to include both sets of URIs for the Googlebot, but (unlike Inktomi&#8217;s <a href=\"http:\/\/www.inktomi.com\/slurp.html\"><cite class=\"title\">Slurp<\/cite><\/a>) Google doesn&#8217;t retrieve <samp>\/robots.txt<\/samp> after it&#8217;s started spidering a site.  I may have to extend my <samp>.htaccess<\/samp> blocking for the current <a href=\"http:\/\/dance.efactory.de\/\"><cite>dance<\/cite><\/a> to prevent the big G from grabbing a bunch of (more) useless garbage from my site.<\/p>\n\n<p>Moral of the story: even if you&#8217;ve read the documentation, read it again before making assumptions.  As my friend <a href=\"http:\/\/www.mdotchronicles.com\/\">John<\/a> is fond of saying, <q>when you <em>assume<\/em> you make an <em>ass<\/em> of <em>u<\/em> and <em>Dave<\/em>.<\/q><\/p><\/div><div class=\"syndication-links\"><\/div>","protected":false},"excerpt":{"rendered":"I recently discovered a subtlety of the \/robots.txt file. (For those who don&#8217;t know, \/robots.txt is a configuration file for web spiders that tells them what URLs not to retrieve from a website.) The issue is this: parsers will not fall back to a more general User-Agent setting if they&#8217;ve already matched a specific one.&hellip;","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"mf2_syndication":[],"venue_id":0},"categories":[3],"tags":[],"kind":false,"_links":{"self":[{"href":"https:\/\/peterjanes.ca\/blog\/wp-json\/wp\/v2\/posts\/277"}],"collection":[{"href":"https:\/\/peterjanes.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/peterjanes.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/peterjanes.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/peterjanes.ca\/blog\/wp-json\/wp\/v2\/comments?post=277"}],"version-history":[{"count":0,"href":"https:\/\/peterjanes.ca\/blog\/wp-json\/wp\/v2\/posts\/277\/revisions"}],"wp:attachment":[{"href":"https:\/\/peterjanes.ca\/blog\/wp-json\/wp\/v2\/media?parent=277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/peterjanes.ca\/blog\/wp-json\/wp\/v2\/categories?post=277"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/peterjanes.ca\/blog\/wp-json\/wp\/v2\/tags?post=277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}