Adding rewrite rules and fixing reply