Preserve path-prefix of base url

This change makes `url-for` preserve the path prefix of the base URL and adds a test of the new functionality.