Fixed rewrite rules, preview mode, and caching paths for documents