Doing add_rewrite_rule only for specific post type

so I have these two rules for projects CPT.

function addMyRules(){      // variables     add_rewrite_tag('%eventid%','([^&]+)');     add_rewrite_tag('%version%','([^&]+)');      // release-template rewrite     add_rewrite_rule('^projects/([^/]*)/([^/]*)/?$  ','index.php?projects=$  matches[1]&version=$  matches[2]','top');     add_rewrite_rule('^projects/([^/]*)/releases/?$  ','index.php?projects=$  matches[1]&version=releases','top');      flush_rewrite_rules(); }  add_action( 'init', 'addMyRules' ); 

But I have to get rid of that /projects/ prefix for some reason. However if I remove it, we end up having a problem that any page that has .com/something/else format would trigger rewrite.

Any way I could loop thru that custom post type and allow rewrite to run only if first var is one of post slugs?