Is This Drupal?


As an avid Drupal user and developer I often find myself poking around on a website trying to figure out if this particular site was built using Drupal or not. Sometimes it is really easy to tell, the powered by Drupal, common login box, and certain themes are a dead giveaway.

Other times it is not that easy. Especially with more and more talented designers and developers making the transition to Drupal.

I came across this article on Lullabot’s website that points out an interesting fact. Since the release of version 4.6 Drupal sets the HTTP Expires header to Expires: Sun, 19 Nov 1978 05:00:00 GMT, the birthday of the projects found Dries.

Certainly not 100% unique, but pretty unlikely that a non Drupal site is going to set the same header. Match this, and you can be fairly certain you’ve got a positive match.

So the wheels start turning, and a couple hours later I’ve whipped together a very simple website that attempts to detect a Drupal installation at the given URL.

http://isthissitebuiltwithdrupal.com

UPDATE: 2/27/2009

The application now checks for the presence of a file named misc/drupal.js that starts with the line “// $Id drupal.js”. This allows the check to work on sites like the onion which area setting their own Expires headers as part of a caching strategy, but is smart enough to not get false positives on sites like Twitter which return a custom 404 page.

If the above test fails it falls back on the previously discussed HTTP Header test. It should be fairly accurate. Let me know if you come up with any false positives and I’ll see what I can do.