fix infinite redirects relating to pages