Adding support for custom page bases

Earlier implementation expected all URLs to start from the root domain.
This one allows to have the whole page in a subpath from the domain, based
on configuration.