How can I add rewrite rules to a class-based plugin?

Any rule that doesn’t point to index.php is interpreted as an external rule and gets added to .htaccess.

$matches array works only when second argument ($redirect) of add_rewrite_rule() point to file index.php. External rules need to use the $1, $2 instead of $matches[1], $matches[2].

Remember to flush rewrite rules after the change.