Support subdir in baseurl

This fixes #334, #325, #230.

Mainly this was a change to helpers.MakePermalink, but to get the local server to run with the subdirectory, we needed to redirect the path of the request from /foo to /.  In addition, I added tests for the server's code for fixing up the base url with different config file & CLI options, and tests for MakePermalink (which were somewhat already covered by the page tests, but I like tests a little closer to the meat of the code, so I know where the failures are).