Work with pretty permalinks disabled

We should try and work with pretty permalinks disabled for compatibility's sake.

This supersedes #69.