Fix URL modification and redirect behaviour.

I realised that by enforcing the "non-empty path" invariant for URLs, I broke redirection. At the moment, the static-file middleware doesn't redirect things like `http://example.com/doc` to `http://example.com/doc/` as it should. This patch fixes that by restoring the original behaviour.