fix redirect rewriting