I am trying to add a rule that catches every request after the other internal WP rules have not matched (e.g. at the bottom of everything).
The code I am trying is below.
add_rewrite_tag('%c%','([^&]+)'); add_rewrite_rule('^([^/]*)', '/?page_id=' . $old_id . '&c=$matches', 'bottom'); global $wp_rewrite; $wp_rewrite->flush_rules(); print("<pre>"); print_r($wp_rewrite->rules);
This code runs, but instead of the rewrite rule ending up on the internal rewrite_rules option in the database, it ends up writing a rule to the .htaccess, which of course then breaks all the URLs on the site as it catches everything.
My understanding from the docs is add_rewrite_rule() adds it to the db rewrites?