Humans.txt

One thing I love about Twitter is the instant feedback. For the past few weeks I’ve been seeing lots of 404 requests like this:

http://perishablepress.com/humans.txt
http://perishablepress.com/humans.txt
http://perishablepress.com/humans.txt

At first I thought it was some skript kiddie getting creative, you know as a play on the robots.txt file, which is also located in the root of many websites. So it seemed interesting enough to tweet about:

Fun new 404 requests appearing in the error logs: http://example.com/humans.txt

Almost instantly there were four replies, letting me know what’s up:

[ Screenshot: Tweets about humanstxt.org ]

This would’ve occurred to me eventually, but the point is that Twitter – or better yet, your Twitter followers – are an incredible resource for quickly gathering information that you never knew existed. Google works fine if you know what you’re looking for, but in this case the whole “humans.txt” thing was news to me.

Robots & Humans

After reading more about humans.txt, I can see it really catching on and becoming something associated with the robots.txt file. Both are plain-text files located in the root directory, but instead of telling compliant robots which pages to crawl (or not crawl), humans.txt provides information about the people and techniques behind the site. It’s definitely an interesting idea, and potentially useful if the same information isn’t already available in a “Contact” or “About” page.

Create a text file called humans.txt (always in lower-case) and make it UTF-8 encoded to avoid issues with special characters and multiple languages. – humanstxt.org

To create a humans.txt file for your site, follow these simple steps:

  1. Place a reference to the file in the <head> of the site:
    <link rel="author" href="humans.txt">
  2. Customize the template below with your details
  3. Save the file and place in your site’s root directory

Here’s the template:

/* TEAM */
	Your title: Your name.
	Site: email, link to a contact form, etc.
	Twitter: your Twitter username.
	Location: City, Country.

	[...]

/* THANKS */
	Name: name or url

	[...]

/* SITE */
	Last update: YYYY/MM/DD
	Standards: HTML5, CSS3,..
	Components: Modernizr, jQuery, etc.
	Software: Software used for the development

	[...]

The official humanstxt.org guidelines tell you to also “add the humansTXT button to your site and link it to your humansTXT file,” but you’re probably safe just linking to your humans.txt file like you would the sitemap. And even then, the information will be there for those who are looking for it.

For further examples, you can inspect the humans.txt file used at the humanstxt.org website and check out the humans.txt file used here at Perishable Press.

Inhuman.txt

So that’s all fine and dandy, but what if you don’t want to provide humans.txt information for your site? You have several options:

  • Do nothing and ignore the countless 404 errors filling your access logs
  • Leave it blank or maybe with a simple message explaining something
  • Redirect requests for the humans.txt file (see below for details)

It could be argued that the humans.txt file is opt-out, with inevitable 404 errors for sites that for whatever reason don’t provide one. This may not be by design, as it’s just as easy to argue that nobody is forcing you to do anything. But if/when the humans.txt catches on, those without the file may want to do something about the repeat 404 errors. Heck, if I were trying to establish a “pancakes.txt” protocol, a sort of black-hat way to attract attention would be to create a few bots to go around requesting http://yoursite.com/pancakes.txt from jillions of sites. You know, make it impossible for people to ignore. Whatever, it’s all good, but if you do want an easy way to clean up the errors, read on..

Redirect requests for humans.txt

To eliminate needless 404 errors from slowing things down and messing up your access logs, either upload a blank humans.txt or add one of these slices to your root .htaccess file:

Using Apache’s mod_alias to redirect all requests for /humans.txt to the URL of your choice:

# REDIRECT HUMANS.TXT
<ifModule mod_alias.c>
 RedirectMatch 301 /humans\.txt$ http://example.com/
</ifModule>

Here is an alternate technique using mod_rewrite:

# REDIRECT HUMANS.TXT
<ifModule mod_rewrite.c>
 RewriteCond %{REQUEST_URI} /humans\.txt$ [NC]
 RewriteRule . http://example.com/ [R=301,L]
</ifModule>

To use either of these methods, just edit the example.com with the URL/path of your choice. Bada-boom, bada-bing. Being human has never been easier! ;)