When you rewrite URLs in WordPress, you can either use flush_rewrite_rules or $wp_rewrite->flush_rules();