Fix bug with duplicated base url

Strips the base URL from SERVER variable when the base url is in the
SERVER variable.