34

On a webserver I now have to admnistrate I noticed that the robots.txt is empty. I wondered if there's a difference between an empty robots.txt and no file at all.

Do crawlers behave differently in these two cases? So, is it safe to just delete an empty robots.txt?

1
  • Is it safe to delete? See my answer about auto-generated robots.txt files.
    – Jay Brunet
    Commented Mar 15, 2022 at 6:42

3 Answers 3

36

Do crawlers behave differently in these two cases?

A robots.txt file that's empty is really no different from one that's not found, both do not disallow crawling.

You might however receive lots of 404 errors in your server logs when crawlers request the robots.txt file, as indicated in this question here.

So, is it safe to just delete an empty robots.txt?

Yes, with the above caveat.

1
  • I could be wrong, but I don't remember seeing the 404 problem with Nginx and error.log
    – Jay Brunet
    Commented Mar 15, 2022 at 6:31
16

No. There's no difference.

You'd get 404 errors in your server log, and if you're subscribed to things like Google Web Master tools it might tell you you've not got one, but in terms of the crawler robot behavior -- they are the same for any robot you care about.

0

I don't know when this started, but WordPress auto-generates robots.txt if you don't have one. In my opinion, this is a terrible change. In my case, the auto-generated WordPress robots.txt file is sending robots to my admin page (?!) and this ended up getting indexed in DuckDuckGo, very strange.

WordPress created some kind of "filter" to configure robots.txt behavior, but a) I can't find any code to keep WordPress out of robots.txt entirely, and b) even if I manage to code something, that only affects one theme and one blog at a time.

I'd say this is a flaw in WordPress, assuming we all want an auto-generated robots.txt file.

Creating a "blank" robots.txt forces WordPress to stay out of my business, and sends the appropriate message to robots.

In short, if you see a blank robots.txt used for a WordPress blog (or some other software) this could be the reason: to prevent the auto-generation of something worse than a blank file.

3
  • Robots.txt doesn't have the ability to "send" bots anywhere. The default robots.txt with wordpress contains: Disallow: /wp-admin/ which does just the opposite. Commented Mar 15, 2022 at 11:13
  • @StephenOstermiller "Allow" tells robots where to go, does it not? I would consider that "sending." Also see my post here wordpress.stackexchange.com/questions/403753/…
    – Jay Brunet
    Commented Mar 15, 2022 at 19:13
  • An Allow: is an exception to a Disallow: directive. It says that even though crawling is not allowed in /wp-admin/ it is allowed in /wp-admin/admin-ajax.php. Bots wouldn't typically try to crawl URLs that are listed as Allow: in robots.txt but they would consult robots.txt to see if they can crawl such URLs when they are found on your site. A blank robots.txt is going to allow crawling of /wp-admin/admin-ajax.php too. It isn't the robots.txt file that is sending bots to that URL, rather it is the code on the site itself (probably in JavaScript.) Commented Mar 15, 2022 at 19:38

Your Answer

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

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