12

I am using following robots.txt file for a site: Target is to allow googlebot and bingbot to access the site except the page /bedven/bedrijf/* and block all other bots from crawling the site.

User-agent: googlebot
Disallow: /bedven/bedrijf/*
Crawl-delay: 10

User-agent: google
Disallow: /bedven/bedrijf/*
Crawl-delay: 10

User-agent: bingbot
Disallow: /bedven/bedrijf/*
Crawl-delay: 10

User-agent: bing
Disallow: /bedven/bedrijf/*
Crawl-delay: 10

User-agent: *
Disallow: /

Does the last rule User-agent: * Disallow: / disallow all bots from crawling every pages on the site?

9
  • 12
    This whole task concerns me. There are other search engines, and anyone who uses them won't see your site. theeword.co.uk/info/search_engine_market says that 4.99% of the internet is not on your search engines. That's a lot of people. A better method would be to monitor your traffic and see if any bot actually causes issues, then block those specifically.
    – GKFX
    Jan 12, 2015 at 19:22
  • 9
    A misbehaving bot could just totally ignore your robots.txt anyways
    – Nick T
    Jan 12, 2015 at 21:13
  • 9
    Really bad bots don't care about robots.txt
    – Osvaldo
    Jan 12, 2015 at 21:38
  • 5
    @NickT, in the real world, there are no shortage of poorly-behaved bots that follow robots.txt, or at least the Disallow: / rule. If your personal website is getting hammered into the ground because a bot programmer never considered that the server might be a Raspberry Pi on the wrong end of a 256 kbit connection, a blanket exclusion like this is useful.
    – Mark
    Jan 13, 2015 at 5:31
  • 2
    @Console why?
    – o0'.
    Jan 13, 2015 at 9:14

2 Answers 2

24

The last record (started by User-agent: *) will be followed by all polite bots that don’t identify themselves as "googlebot", "google", "bingbot" or "bing".
And yes, it means that they are not allowed to crawl anything.

You might want to omit the * in /bedven/bedrijf/*.
In the original robots.txt specification, * has no special meaning, it’s just a character like any other. So it would only disallow crawling of pages that literally have the character * in their URL.
While Google doesn’t follow the robots.txt specification in that regard, because they use * as a wildcard for "any sequence of characters", it’s not needed for them in this case: /bedven/bedrijf/* and /bedven/bedrijf/ would mean exactly the same: block all URLs whose path begins with /bedven/bedrijf/.

And finally, you could reduce your robots.txt to two records, because a record can have multiple User-agent lines:

User-agent: googlebot
User-agent: google
User-agent: bingbot
User-agent: bing
Disallow: /bedven/bedrijf/
Crawl-delay: 10

User-agent: *
Disallow: /
3
  • 5
    Note that Google ignores the crawl-delay directive in robots.txt. You have to set it in Google Webmaster Tools instead. Jan 13, 2015 at 2:51
  • User-agents are case sensitive so this will actually block Google which uses Googlebot
    – minou
    May 30, 2020 at 15:58
  • @gaefan: The robots.txt spec doesn’t say that the User-agent values are case-sensitive. Instead it recommends: "The robot should be liberal in interpreting this field. A case insensitive substring match of the name without version information is recommended." -- Could be the case that Google doesn’t follow this recommendation, but that would surprise me.
    – unor
    May 30, 2020 at 20:00
-3

Bots, especially bad ones, may ignore robots.txt file. So no matter what is written there some bots may crawl your site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.