check for rewrite rules, flush if needed