adding support for subcategories in the rewrite rules