index rewriting