Override the layers getURL BEFORE the layer gets added to the map, and make sure that the metadata.isBaseLayer gets set on the layer before it gets added to the map