> isn't webroot already holding the full address?

No, it only holds e.g. `/owncloud`

> unit tests are welcome

Yeah, I'd love to, but I wouldn't know how to simulate a running instance. Are there any comprehensible tests I could use as a starting point?