Let $p_n(x)$, $n=0,1,dots$, be the orthogonal polynomials with respect to a given density $dmu(x)$. Furthermore, let $d u(x)$ be a density which arises from $dmu(x)$ by multiplication by a rational function in $x$. We prove a formula that expresses the Hankel determinants of moments of $d u(x)$ in terms of a determinant involving the orthogonal polynomials $p_n(x)$ and associated functions $q_n(x)=int p_n(u) ,dmu(u)/(x-u)$. Uvarovs formula for the orthogonal polynomials with respect to $d u(x)$ is a corollary of our theorem. Our result generalises a Hankel determinant formula for the case where the rational function is a polynomial that existed somehow hidden in the folklore of the theory of orthogonal polynomials but has been stated explicitly only relatively recently (see [arXiv:2101.04225]). Our theorem can be interpreted in a two-fold way: analytically or in the sense of formal series. We apply our theorem to derive several curious Hankel determinant evaluations.