Use URL-safe base64 encoding for ids

This prevents issues related to passing IDs in URL paths by making them
url-safe.

RFC4648 has details: http://tools.ietf.org/html/rfc4648#section-5

This is a better solution than #70.