Amorphous solid water (ASW) is found on icy dust grains in the interstellar medium (ISM), as well as on comets and other icy objects in the outer solar system. The optical properties of ASW are thus relevant for many astrophysical environments, but in the ultraviolet-visible (UV-vis), its refractive index is not well constrained. Here, we introduce a new method based on UV-vis broadband interferometry to measure the wavelengthdependent refractive index n(λ) of amorphous water ice from 10 to 130 K, i.e., for different porosities, in the wavelength range of 210-757 nm. We also present n(λ) for crystalline water ice at 150 K, which allows us to compare our new method with literature data. Based on this, a method to calculate n(λ, ρ) as a function of wavelength and porosity is reported. This new approach carries much potential and is generally applicable to pure and mixed ice, both amorphous and crystalline. The astronomical and physical-chemical relevance and future potential of this work are discussed.