Fix infinite-redirect loop on generated image pages