Rewrite controller