instantiate an URL object if base_url is a string