changed redirect to rewrite