Fix include of piwik tracking code

* Fix rewrite rule so it won't interfere with subrequests
* Switch from environment variable to SERVER_NAME as the way of
  telling whether we are in production