extract a baseurl which may dynamic change