Rewrite URL loop fix